# Traefik misinterpreting services listed with dynamic configuration file

**URL:** <https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783>\
**Category:** Traefik v2\
**Tags:** file, docker\
**Created:** [September 16, 2022, 3:19am UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783 "2022-09-16T03:19:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevdog](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kevdog/32/2825_2.png) [@kevdog](https://community.traefik.io/u/kevdog)\
**Post date:** [September 16, 2022, 3:19am UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783/1 "2022-09-16T03:19:51Z")

</div>

I just upgraded from traefik 2.6.2 to traefik 2.8.5 -- didn't change anything in my static or dynamic configuration files. Traefik is now misinterpreting the services listed in dynamic configuration file under the http routers section. Let me post some examples and screenshots.

Here is a snippet of my dynamic configuration file:

```auto
http:
  routers:
    nc.domain.com:
      rule: "Host(`nc.domain.com`)"
      entryPoints:
        - web
        - websecure
      middlewares:
        - mw_nextcloud_host_header
        #- mw_compress_headers
        - mw_nextcloud_caldav
        - mw_security_headers
      service:
        - sv_proxy_pass_nc.domain.com
      tls:
        options: modern@file
        certResolver: le
        domains:
          - main: nc.domain.com
            sans:
              - nc.domain.com

```

Nothing really to speak of in the configuration file.

Here however is a screen capture of the dashboard:

 ![Screen Shot 2022-09-15 at 10.12.27 PM](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bdc8f7da7b905e56765706e406b5b547ca82154d.png)

Look how the service is listed: || 24 || sv\_proxy\_pass.nc.domain.com@file

What is the || 24 || part?  
I'm getting an error because the router cant find a service literally named: || 24 || sv\_proxy\_pass.nc.domain.com@file

I have a service defined sv\_proxy\_pass.nc.domain.com@file (as defined in the same dynamic config file and confirmed on the dashboard).

All my router defined services in this file have the exact same || 24 || extension. Looks like a format error or something.

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [September 16, 2022, 7:31am UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783/2 "2022-09-16T07:31:20Z")

</div>

Hello,

it's because `service` in the router must be a string instead of an array.

```auto
http:
  routers:
    nc.domain.com:
      rule: "Host(`nc.domain.com`)"
      entryPoints:
        - web
        - websecure
      middlewares:
        - mw_nextcloud_host_header
        #- mw_compress_headers
        - mw_nextcloud_caldav
        - mw_security_headers
      service: sv_proxy_pass_nc.domain.com ## <------ Here the fix
      tls:
        options: modern@file
        certResolver: le
        domains:
          - main: nc.domain.com
            sans:
              - nc.domain.com

```

One easy way to check whether a configuration file is well-formed is to validate it with:

- [JSON Schema of the static configuration](https://json.schemastore.org/traefik-v2.json)
- [JSON Schema of the dynamic configuration](https://json.schemastore.org/traefik-v2-file-provider.json)

---

<div class="post-metadata">

**Author:** ![kevdog](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kevdog/32/2825_2.png) [@kevdog](https://community.traefik.io/u/kevdog)\
**Post date:** [September 16, 2022, 1:19pm UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783/3 "2022-09-16T13:19:08Z")

</div>

Hey thanks for the solution which it did work. Just a question however -- is this a recent change? My old configuration using an array worked for quite a long time.

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [September 16, 2022, 1:37pm UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783/4 "2022-09-16T13:37:15Z")

</div>

`service` has always been a string, not an array.

Since v2.8 we fixed a bug around configuration, so now an error is reported when a configuration is invalid.

---

<div class="post-metadata">

**Author:** ![kevdog](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kevdog/32/2825_2.png) [@kevdog](https://community.traefik.io/u/kevdog)\
**Post date:** [September 16, 2022, 1:53pm UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783/5 "2022-09-16T13:53:07Z")

</div>

I see. Weird however, in the older versions using a single value within an array actually worked (as you probably know). So in the older versions no error was reported but the system still functioned. In the newer versions the error is reported (in a very cryptic way) and the system fails to work. I don't know a lot about programming and dealing with yaml structures, but my only take away from this would be that the error is reported in more clear manner. || 24 || means nothing to me although I'm interpreting this must mean wrong expected format.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [September 19, 2022, 1:53pm UTC](https://community.traefik.io/t/traefik-misinterpreting-services-listed-with-dynamic-configuration-file/15783/6 "2022-09-19T13:53:36Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
