## TL;DR
Restore the original data source UID if you can, because dashboards reference data sources by UID, not by name. Recreate or edit the data source so its UID matches the value stored in the dashboard JSON, or run a careful find and replace across the exported dashboard JSON to the new UID, then reimport. Renaming a data source does not break panels, changing its UID does.

```text
data source was not found
```

## Use this when
- Dashboards broke immediately after a Grafana migration, restore, or provisioning change.
- A data source with the expected name exists, but panels still say it was not found.
- Exported dashboard JSON references a UID that no current data source carries.

## Not for this skill when
- The panel finds its source but the query returns an error from the backend. Debug the query and backend credentials instead.
- One new panel fails while old dashboards work. That panel was probably pointed at a deleted source directly.

## Steps
1. Export one broken dashboard as JSON and search it for the datasource UID values used by panels and variables. Verify: you can list every distinct UID the dashboard references
2. List the current data sources through the API or the connections page and compare their UIDs with the referenced values. Verify: the referenced UID is absent from the current data source list
3. If the original instance still exists, read the original UID there and edit the recreated data source to carry that UID, where the deployment method allows it. Verify: the data source settings show the restored UID
4. Where the UID cannot be restored, update the dashboard JSON references to the new UID, including variables and annotations, and reimport the dashboard. Verify: the import completes and panels show queries instead of the not found message
5. For provisioned data sources, pin the UID in the provisioning file so the next rebuild keeps the same reference. Verify: the provisioning file contains an explicit UID entry for each source
6. Open the dashboard and run each variable and panel query, then save the dashboard in the current Grafana version. Verify: all panels return data and the dashboard saves without a version warning

## Why it happens
UID based references make Grafana dashboards portable only when UIDs travel with them. Provisioning and migration tooling that treats the data source name as the identity silently breaks that contract. Pinning UIDs in provisioning, or migrating dashboards and data sources together with their UIDs intact, prevents the entire class of failure on the next move.

Grafana stores a UID on every data source and writes that UID into panel targets and dashboard variables. A migration that recreates data sources, a provisioning file that omits the UID, or a restore into a fresh instance generates new UIDs, so every stored reference points at nothing and panels report the source as not found even though a source with the same name exists. The dashboard JSON shows the stale UID in the panel and templating sections.

Field notes for Grafana specifically. The server log at startup and the provisioning and alerting sections are where instance level truth lives, and the dashboard JSON model view in the interface shows exactly what Grafana stored, which settles most arguments about what a panel is really querying. Grafana changes behaviour across versions in the alerting and provisioning areas especially, so record the version in every incident note. Instances managed as code should treat the Git copy of a dashboard as the source to fix, with interface edits treated as drafts to be ported back.

A Grafana habit that prevents repeat incidents is to keep one small health dashboard for the monitoring system itself, showing data source query success, alert evaluation state, and provisioning status. Monitoring the monitor sounds recursive, but the failures in this family are silent by nature, empty variables, unevaluated rules, missing dashboards, and a health view is the only surface where silence itself becomes visible. Checking it after every upgrade, migration, or provisioning change catches the breakage in the same hour it was introduced.
## Variants and edge cases
### Grafana data source not found after upgrade panels broken
The upgrade-triggered variant of the UID mismatch.
### Grafana dashboard datasource UID mismatch fix
The root-cause phrasing naming UIDs directly.
### Grafana provisioned datasource UID changed panels fail
The provisioning-specific variant for as-code deployments.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_IczTRXnclPr0JSWtnJ2pKw
