Issue with library panels

  • What Grafana version and what operating system are you using?
    v8.3.2 (afb9e8e5f3)

  • What are you trying to achieve?
    I am trying to update a dashboard using the api.

  • How are you trying to achieve it?
    Using a python script that copies the dashboard JSON and adds/removes/replaces parts of the JSON and re upload a valid JSON using an api post request to our grafana server.

  • What happened?
    The dashboards are using panels from panel Library. When navigating to the dashboard in the web UI we get a plugin not found error message on the panels.

The panel type is empty when reviewing the JSON after the post request. Panel Library meta data is intact. Manually adding the panel type (ex. stat) and refreshing fixes all the broken panels.

The bug appears similar to Error when import dash with panel library but in our case we are doing it using the grafana API not the UI.

  • What did you expect to happen?

I expected that the library panels were successfully added to the dashboard with the API post.

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

UI Errors:

Panel plugin not found: Name: “xxxx”, UID: xxxx

Checking the JSON Model after the post:
“libraryPanel”: {

    "name": "information",

    "uid": "6_fkwhxnk"

  },

  "type": "Name: \"information\", UID: \"6_fkwhxnk\""

},

If we change ONE of panels the type to “stat” it will fix the dashboard with the library panels even if there are 100 type set to “type”:"\name\uid"

Please note if I run the same script and the JSON doesnt include libraryPanel it will work as expected.

API Errors:

The json response we have from grafana is:
Error while connecting library panels
{‘message’: ‘Error while connecting library panels’}

This code is raising the error:
// load library panels JSON for this dashboard
err = hs.LibraryPanelService.LoadLibraryPanelsForDashboard(c.Req.Context(), dash)
if err != nil {
return response.Error(500, “Error while loading library panels”, err)
}

  • Did you follow any online instructions? If so, what is the URL? No (custom script)
2 Likes

I am having the same issue.

image

And add to your point “did you follow any online instructions” there are some here (however, they are not helpful in this case: Panel editor overview | Grafana documentation

4 Likes