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:
# Add the router
entryPoints = ["web"]
middlewares = ["my-basic-auth"]
service = "service-foo"
rule = "Path(/foo)"

# Add the middleware
users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
usersFile = "etc/traefik/.htpasswd"

# Add the service
url = "http://foo/"
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.