Error when importing a dashboard into a grafana docker container

  • What Grafana version and what operating system are you using?

Grafana v9.1.6 on a Debian VM and Grafana v9.2.2 in a docker container

  • What are you trying to achieve?

I want to import a dashboard from my locally running grafana instance into a new docker container running the latest version of the grafana/grafana image.

  • How are you trying to achieve it?

Copying the JSON model of my Dashboard and pasting it to the “import” tab on my grafana container.

  • What happened?


Error: Internal Server Error: Check the Grafana Server Logs for the detailed error message

The dashboard was imported with the panels having the right size and names, but without any queries. I also can’t edit the queries, I am getting an internal server error when trying to edit those. The error messages stating that “a dashboard with that name already exists” are popping up as soon as I click the import button without the dashboard actually existing before pressing the import button.

In my logs, I got this message:

logger=context userId=1 orgId=1 uname=admin t=2022-10-27T08:05:59.758454759Z level=error msg="Request error" error="assignment to entry in nil map" stack="/usr/local/go/src/runtime/map_faststr.go:205 (0x412e2b)
/drone/src/pkg/services/libraryelements/database.go:65 (0x1e65297)
/drone/src/pkg/services/libraryelements/database.go:136 (0x1e65abf)
/drone/src/pkg/services/libraryelements/libraryelements.go:47 (0x1e6ac23)
/drone/src/pkg/services/librarypanels/librarypanels.go:317 (0x203cb87)
/drone/src/pkg/services/librarypanels/librarypanels.go:262 (0x203c297)
/drone/src/pkg/services/dashboardimport/service/service.go:104 (0x27d518b)
/drone/src/pkg/services/dashboardimport/api/api.go:77 (0x27d38ab)
/drone/src/pkg/api/routing/routing.go:17 (0x14cb727)
/drone/src/pkg/api/response/web_hack.go:40 (0x10561a7)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:135 (0xef977b)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/middleware/csp.go:22 (0x14c3243)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/services/contexthandler/contexthandler.go:175 (0x14affa3)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/render.go:44 (0xefa2c3)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/macaron.go:141 (0xef981f)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/middleware/csrf/csrf.go:64 (0x1ef72df)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/middleware/recovery.go:171 (0x14c650b)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/middleware/logger.go:40 (0x14c4203)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/middleware/request_metrics.go:58 (0x14c7257)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/middleware/request_tracing.go:88 (0x14c8803)
/usr/local/go/src/net/http/server.go:2109 (0x6bf687)
/drone/src/pkg/web/context.go:44 (0xef8327)
/drone/src/pkg/web/router.go:155 (0xefb67f)
/drone/src/pkg/web/router.go:211 (0xefc24f)
/drone/src/pkg/web/macaron.go:161 (0xef9bfb)
/usr/local/go/src/net/http/server.go:2947 (0x6c25bb)
/usr/local/go/src/net/http/server.go:1991 (0x6be473)
/usr/local/go/src/runtime/asm_arm64.s:1172 (0x46dda3)
"
  • What did you expect to happen?

Importing the dashboard without an error.

  • Did you follow any online instructions? If so, what is the URL?

I already searched for online help, but couldn’t find anything similar.

Welcome

Does the source dashboard grafana have any plugins that the destination grafana does not have installed?

Hi, thanks for your answer.

The source Dashboard has no special plugins, I checked that. The source Dashboard basically contains two Gauges on top and a bunch of Time Series Panels under it.
Some panels in the dashboard are library Panels, I copied my Dashboard on the local instance and deleted the links to the library panel, but apparently it had no effect on the outcome.

One other thing I realized is that datasources are not imported when importing a Dashboard JSON. I am using InfluxDB v2 datasources (with Flux queries) and when importing a simpler Dashboard which does not throw an error in my docker container, the queries are not correctly imported due to the datasource not being present and grafana assuming an InfluxDB datasource with InfluxQL Queries. After exporting the relevant datasource and importing it into the container, the queries are displayed correctly, but the main problem of my bigger Dashboard not being able to be imported remains.

It seems like I missed unlinking some library panels when I deleted them in a copy of my Dashboard. I tried to troubleshoot the problem by creating new Dashboards with only a single Panel being either a library panel or a non-library panel. Turns out that the error is thrown on my library panel Dashboards and not on my regular Dashboards. After unlinking the library panel, the import works on both my test Dashboard as well as my big Dashboard.

Maybe I will export and import the Library panels via API calls from now on if I want to copy an existing Dashboard to a new Grafana Instance :smile:

1 Like