No valid configuration found in file

I am trying to specify a dynamic configuration using a file. Whatever I try including the examples from the website I get:
No valid configuration found in file
Then traefik exits with a code 1.

The current file is:
[http]
# Add the router
[http.routers]
[http.routers.router0]
entryPoints = ["web"]
middlewares = ["my-basic-auth"]
service = "service-foo"
rule = "Path(/foo)"

# Add the middleware
[http.middlewares]
[http.middlewares.my-basic-auth.basicAuth]
users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
"test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"]
usersFile = "etc/traefik/.htpasswd"

# Add the service
[http.services]
[http.services.service-foo]
[http.services.service-foo.loadBalancer]
[[http.services.service-foo.loadBalancer.servers]]
url = "http://foo/"
[[http.services.service-foo.loadBalancer.servers]]
url = "http://bar/"

What am I doing wrong ?

Please format your config with 3 backticks before and after or select code and press </> .

The issue here was, I had called my dynamic file, /etc/traefik/traefik.yml which by coincidence is the default name for the static file. So traefik was starting and trying to parse the dynamic config file as a static config file and falling over.