Skip to content
Latchkey

Grafana "Data source not found" in CI

Grafana returns "Data source not found" when a dashboard panel, alert, or API call points at a datasource UID or name that is not provisioned in the instance the pipeline targets. The reference is dangling.

What this error means

A dashboard import or query API call fails with {"message":"Data source not found"} (HTTP 404), or panels render "Datasource ... was not found".

Grafana
< HTTP/2 404
{"message":"Data source not found"}

Common causes

A hard-coded datasource UID does not exist in this instance

Dashboards exported from one Grafana embed a UID; importing into another instance where that UID was never created yields "not found".

The datasource was not provisioned before the dashboard

The pipeline imports dashboards before creating the datasource, so the reference resolves to nothing.

How to fix it

Provision the datasource first

  1. Create the datasource via the API or provisioning with a stable UID.
  2. Import dashboards that reference that UID afterward.
  3. Verify the panel resolves the datasource.
provisioning/datasources/ds.yaml
apiVersion: 1
datasources:
  - name: Prometheus
    type: prometheus
    uid: prometheus-main
    url: http://prometheus:9090

Use a datasource variable in dashboards

Templating the datasource avoids hard-coded UIDs so the dashboard binds to whatever exists in the target instance.

How to prevent it

  • Provision datasources before importing dashboards.
  • Use stable UIDs or datasource template variables.
  • Keep datasource definitions in version control alongside dashboards.

Frequently asked questions

What causes "Grafana "Data source not found""?
Dashboards exported from one Grafana embed a UID; importing into another instance where that UID was never created yields "not found".
How do I fix Grafana "Data source not found"?
Provision the datasource first

Related guides

References

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