# How to debug plugin errors

hi

we made a plugin (duplicateheader) and it works, but sometimes I get an error:

``````plugins-storage/sources/gop-721926268/src/github.com/containeroo/duplicateheader/duplicateheader.go:34:6: panic
``````

any idea how I can get a better error message?

best,
giotto

Hello,

could you provide a small reproducible example?

It's probability an issue with Yaegi.

Hi Idez

I create this middleware:

``````middlewares:
cf-real-ip:
plugin:
source: Cf-Connecting-Ip
destination:
- X-Real-Ip
- X-Forwarded-For
``````

I add the middleware to the websecure entrypoint:

``````- --entrypoints.websecure.http.middlewares=cf-real-ip@file
``````

The Plugin works, it can copy the Header `Cf-Connecting-Ip` to the Headers `X-Real-Ip` and `X-Forwarded-For`. I checked this in some access-logs.

The error happens randomly and not so oftem.

fyi:

We try to update the headers with `req.Header.Set`, the error came anyway. The we try to update the headers with `req.Header.Del` and `req.Header.Add`, but the error also appears.