Skip to content
Latchkey

Traefik "middleware ... does not exist" in CI

A Traefik router lists a middleware that is not defined, or names it without the provider suffix (@file, @kubernetescrd). Traefik cannot resolve the reference, so the router is dropped.

What this error means

Traefik logs "middleware X does not exist" and the router that referenced it is removed from the active configuration.

traefik
level=error msg="middleware auth@file does not exist" routerName=my-router@file

Common causes

The middleware is not defined

The router references a middleware name that has no matching entry under http.middlewares.

Missing provider namespace on the reference

Cross-provider references need a suffix like @file or @kubernetescrd; without it Traefik looks in the wrong namespace.

How to fix it

Define the middleware and reference it correctly

  1. Add the middleware under http.middlewares.
  2. Reference it on the router, including the provider suffix when crossing providers.
  3. Reload and confirm the router keeps the middleware.
traefik-dynamic.yml
http:
  middlewares:
    auth:
      basicAuth:
        users:
          - "user:$apr1$..."
  routers:
    my-router:
      middlewares:
        - auth@file

Match Kubernetes CRD middleware namespaces

For the Kubernetes provider, reference the Middleware by <namespace>-<name>@kubernetescrd so it resolves.

ingress.yaml
traefik.ingress.kubernetes.io/router.middlewares: default-auth@kubernetescrd

How to prevent it

  • Define every middleware before referencing it on a router.
  • Include the provider suffix on cross-provider middleware references.
  • Validate the merged dynamic config in CI.

Frequently asked questions

What causes "Traefik "middleware does not exist""?
The router references a middleware name that has no matching entry under http.middlewares.
How do I fix Traefik "middleware does not exist"?
Define the middleware and reference it correctly

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card