File provider error

I recently built a new docker traefik instance (v2.10.1) on another server. The traefik.yml's are identical. However, on the new server it won't load the config.yml. I get the following error below. The error says, "Line 43," is where the problem is at however, that has nothing to do with file providers section of traefik.yml. That line is the "https" in entrypoints section. So not sure where it got the line error from.

The server starts, but it doesn't use the config because of the error. Everything looks right to me so I'm not sure what I'm missing...

error:
level=error msg="Error while building configuration (for the first time): yaml: line 43: did not find expected '-' indicator" providerName=file

Per Traefik documentation there is no "-" indicator required. This works on my other server...which is why I don't understand why its asking for a "-" on this one.

Docs:

providers:
  file:
    filename: /path/to/config/dynamic_conf.yml

My traefik.yml

# STATIC CONFIG (restart traefik to update)

# shows you a log msg if a newer image tag can be used
global:
  checkNewVersion: true

# log default is ERROR, but WARN is more helpful
log:
  level: WARN
  # level: INFO
  # level: DEBUG

# enable dashboard on 8080 with NO AUTH
api:
  insecure: true
  dashboard: true

# enable ping so the `traefik healthcheck` works
ping: {}

# auto-proxy containers if they have proper labels
# and also use this file for dynamic config (tls)

providers:
  docker:
    exposedByDefault: false
    watch: true
  file:
    filename: /config.yml
    watch: true

# listen on 80/443, and redirect all 80 to 443 via 301

entryPoints:
  http:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: https
          scheme: https
          Permanent: true
  https:
    address: ":443"

Can't find the error. Maybe stick to the usual web and websecure and while rewriting it, you kill the hidden tab messing up the spacing :wink:

entryPoints:
  web:
    address: :80
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https

  websecure:
    address: :443

(Doc)

Maybe the error is in /config.yml?

Ok, so the error was related to the contents of the config file itself.

It would be nice if the error were more specific so you actually know where to look...

I have a very long config and eyeing and looking at it in VSCode wasn't enough I guess with the wall of text. I found the error, but it had nothing to do with a "-" indicator it was a spacing issue...one of the sections underneath line 43 needed to be moved forward two spaces. This slipped by me because yaml wise it was good but config wise it was in the wrong place.

So I guess the lesson learned here is do not just check if yaml is correct but config alignment as well. Also if you see this error may want to check your config file not traefik.yml.

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