# Using the error middleware always trigger an error: "the service "@provider" does not exist"

**URL:** <https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946>\
**Category:** Traefik v3 (latest)\
**Tags:** middleware, docker\
**Created:** [June 22, 2026, 6:22pm UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946 "2026-06-22T18:22:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NotaInutilis](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@NotaInutilis](https://community.traefik.io/u/NotaInutilis)\
**Post date:** [June 22, 2026, 6:22pm UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/1 "2026-06-22T18:22:48Z")

</div>

Hi, I'd like to ask for some help with using the error middleware with Traefik 3.7.5 on Docker. I'm getting an error which looks unrelated and I'm not sure if it's a configuration issue or a bug.

I'm trying to create an error middleware rewriting 403 to 500 but always get an unrelated error `the service "@provider" does not exist` when using it.

In the file provider:

```auto
    local_ip:
      IPAllowList:
        sourceRange:
          - 127.0.0.1/32
          - 10.0.0.0/8
          - 172.16.0.0/12
          - 192.168.0.0/16

    rewrite_status:
      errors:
        statusRewrites:
          "403": 500
  
    local_only:
      chain:
        middlewares:
          - rewrite_status
          - local_ip

```

In the docker compose:

```auto
    labels:
      - traefik.enable=true
      - traefik.http.routers.test.rule=Host(`test.com`)
      - traefik.http.routers.test.middlewares=local_only@file

```

Also tried using docker labels:

```auto
    labels:
      - traefik.enable=true
      - traefik.http.routers.test.rule=Host(`test.com`)
      - traefik.http.middlewares.rewrite_stat.errors.statusRewrites.403=500
      - traefik.http.routers.test.middlewares=test_mw
      - traefik.http.middlewares.test_mw.chain.middlewares=local_ip@file,rewrite_stat

```

The `local_ip@file` middleware on its own works well. It allows to quickly test from a mobile connection.

Accessing `test.com` gives a 404.

On the traefik dashboard, the error middleware shows an error:

- the service "@file" does not exist when using the file provider (local\_only@file)
- the service "@docker" does not exist when using docker labels (test\_mw)

![Image](https://github.com/user-attachments/assets/7242bee6-c89f-4411-bda8-c92cc01e599f)

When the middleware is not used in a chain or a label, it shows up in the dashboard with no error.

The error message is really puzzling as the providers do exist and work which does not help me identify what the issue could be here.

---

<div class="post-metadata">

**Author:** ![leamikmik](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/leamikmik/32/11303_2.png) [@leamikmik](https://community.traefik.io/u/leamikmik)\
**Post date:** [August 6, 2026, 8:00am UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/2 "2026-08-06T08:00:43Z")

</div>

Hi, did you find a solution?

---

<div class="post-metadata">

**Author:** ![leamikmik](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/leamikmik/32/11303_2.png) [@leamikmik](https://community.traefik.io/u/leamikmik)\
**Post date:** [August 6, 2026, 8:12am UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/3 "2026-08-06T08:12:35Z")

</div>

I found the solution. The errors middleware requires a service to work

---

<div class="post-metadata">

**Author:** ![viktoriyanavrotskaya](https://avatars.discourse-cdn.com/v4/letter/v/59ef9b/32.png) [@viktoriyanavrotskaya](https://community.traefik.io/u/viktoriyanavrotskaya)\
**Post date:** [August 10, 2026, 12:20pm UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/4 "2026-08-10T12:20:49Z")

</div>

> [@NotaInutilis](#):
>
> Hi, I'd like to ask for some help with using the error middleware with Traefik 3.7.5 on Docker. I'm getting an error which looks unrelated and I'm not sure if it's a configuration issue or a bug.
> 
> I'm trying to create an error middleware rewriting 403 to 500 but always get an unrelated error `the service "@provider" does not exist` when using it.
> 
> In the file provider:
> 
> ```auto
> local_ip:
> IPAllowList:
> sourceRange:
> - 127.0.0.1/32
> - 10.0.0.0/8
> - 172.16.0.0/12
> - 192.168.0.0/16
> 
> rewrite_status:
> errors:
> statusRewrites:
> "403": 500
>   
> local_only:
> chain:
> middlewares:
> - rewrite_status
> - local_ip
> 
> ```
> 
> In the docker compose:
> 
> ```auto
> labels:
> - traefik.enable=true
> - traefik.http.routers.test.rule=Host(`test.com`)
> - traefik.http.routers.test.middlewares=local_only@file
> 
> ```
> 
> Also tried using docker labels:
> 
> ```auto
> labels:
> - traefik.enable=true
> - traefik.http.routers.test.rule=Host(`test.com`)
> - traefik.http.middlewares.rewrite_stat.errors.statusRewrites.403=500
> - traefik.http.routers.test.middlewares=test_mw
> - traefik.http.middlewares.test_mw.chain.middlewares=local_ip@file,rewrite_stat
> 
> ```
> 
> The `local_ip@file` middleware on its own works well. It allows to quickly test from a mobile connection.
> 
> Accessing `test.com` gives a 404.
> 
> On the traefik dashboard, the [website](https://tropical-casino.com/)middleware shows an error:
> 
> - the service "@filefilefilefile" does not exist when using the file provider (local\_only@file)
> - the servi@d@dockerckere "@docker" does not exist when using docker labels (test\_mw)
> 
> ![Image](https://github.com/user-attachments/assets/7242bee6-c89f-4411-bda8-c92cc01e599f)
> 
> When the middleware is not used in a chain or a label, it shows up in the dashboard with no error.
> 
> The error message is really puzzling as the providers do exist and work which does not help me identify what the issue could be here.

The errors middleware requires a service field, not just statusRewrites. That empty service is why Traefik com@providerlains about "@provider" not existing, it's trying to resolve a blank service name against the provider. The errors middleware needs to point at a backend service that serves your custom error page. Add a service key pointing to a defined service and the resolution error should clear.

---

<div class="post-metadata">

**Author:** ![NotaInutilis](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@NotaInutilis](https://community.traefik.io/u/NotaInutilis)\
**Post date:** [August 10, 2026, 12:56pm UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/5 "2026-08-10T12:56:31Z")

</div>

Oh, thanks for looking into that! I'll try and test that later.

So it might not be a bug but a documentation issue as the configuration options of the errors middleware list service as not required.

> **[Configuration Options - Traefik Errors Documentation - Traefik](https://doc.traefik.io/traefik/reference/routing-configuration/http/middlewares/errorpages/#configuration-options)**
>
> The errors middleware returns a custom page in lieu of the default, according to configured ranges of HTTP Status codes. | In Traefik Proxy, the Errors middleware returns custom pages according to configured ranges of HTTP Status codes. Read the...

---

<div class="post-metadata">

**Author:** ![NotaInutilis](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@NotaInutilis](https://community.traefik.io/u/NotaInutilis)\
**Post date:** [August 10, 2026, 1:26pm UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/6 "2026-08-10T13:26:38Z")

</div>

There's one thing that is puzzling me though: Traefik can already display errors, so why does it need another service to display them here? My goal is to only change the http status code in certain circumstances, not display fancy error pages so if possible, I'd like to avoid adding another service.

After further research on the topic it seems that there is a plugin for this and that describe my use case.

"Some apps become unhappy when they receive unexpected error codes, such as when Traefik can't find an available server.  
This plugin solves this issue by filtering and replacing problematic error codes with ones the app won't complain about."

> **[GitHub - PseudoResonance/traefikerrorreplace: Traefik middleware plugin to filter and replace...](https://github.com/PseudoResonance/traefikerrorreplace)**
>
> Traefik middleware plugin to filter and replace status codes

---

<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:** [August 13, 2026, 1:27pm UTC](https://community.traefik.io/t/using-the-error-middleware-always-trigger-an-error-the-service-provider-does-not-exist/29946/7 "2026-08-13T13:27:04Z")

</div>

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