## TL;DR

When a Grafana panel shows no data, test the query directly against the datasource first, then check the dashboard time range and template variables. Nine times out of ten the query is fine and the dashboard context is wrong. Debug the query outside Grafana before touching the panel.

## Error / query

```text
Grafana dashboard shows no data URIs query debugging
```

The panel is empty but youre pretty sure the data exists. The bug is usually in the dashboard wrapping, not the query.

## Use this skill when

- a Grafana panel shows no data but the metric exists
- a dashboard broke after a migration or datasource change
- template variable changes empty out every panel
- youre debugging someone elses dashboard

## Not for this skill when

- the datasource has no data at all (see the Prometheus "no data" skill)
- Grafana itself wont load (a server problem)
- you need to build a new dashboard from scratch (a construction task)

## Steps

### 1. Run the panel query raw against the datasource

Copy the query from the panel inspector and run it directly. If data comes back, the datasource is fine and the problem is in the dashboard.

```bash
curl -s --get "http://YOUR-prometheus-host/api/v1/query_range" \
  --data-urlencode "query=rate(http_requests_total[5m])" \
  --data-urlencode "start=$(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%SZ)" \
  --data-urlencode "end=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  --data-urlencode "step=60s" | head -c 200
```

Expected: data points come back. If they do, stop blaming the datasource; the bug is in the panel config.

### 2. Check the time range and template variables

The two most common culprits: a time picker set to a quiet window, and a template variable selecting a value that matches no label.

```bash
echo "Check 1: Grafana time picker. 'Last 5 minutes' on a quiet service looks like no data."
echo "Check 2: each template variable. Does the selected value match a real label value?"
echo "Check 3: the panel inspect view shows the exact query Grafana sent. Compare it to step 1."
```

Expected: you find the mismatch: a time range with no traffic, or a variable value that filters everything out. Fix the picker or the variable.

### 3. Check the interval and min step on sparse metrics

If the metric reports every 5 minutes but the panel queries every 15 seconds, most points are empty and the panel looks dead.

```bash
echo "If the metric scrapes every 5m but the panel min step is 15s, the graph goes empty."
echo "Fix: set the panel Min interval to the scrape interval, or use a $__rate_interval style range."
```

Expected: after setting Min interval to the scrape interval, the panel fills in. Sparse metrics need matching intervals.

## Variant phrasings

### grafana panel no data but query works

Same fix: the query works, so the problem is time range, variables, or interval. Steps 2 and 3 cover all three.

### grafana template variable no data

Same fix: check the variable value against real label values (step 2, check 2). A variable pointing at a renamed label empties every panel that uses it.

### dashboard empty after migration

Same fix: migrations break datasource UIDs and variable queries first. Re-run step 1 against the new datasource, then re-check variables.

## Why it happens

Grafana wraps your query in context: a time range, template variables, and an interval. Any one of those can silently filter your data to nothing while the underlying query is perfectly fine. People debug the query because its visible, but the invisible context is usually the culprit.

## Edge cases and pitfalls

- Datasource provisioned wrong: test with Grafanas Explore view, which skips dashboard context entirely.
- Mixed datasources in one dashboard: each query needs its own check. One broken datasource empties only its panels.
- Dashboard imported from elsewhere: variable names rarely match your labels. Expect to remap every variable.
- Browser extensions breaking Grafana: it happens more than youd think. Try incognito before deep debugging.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_lIJwcQpbim-4E88ACGr_Vw
