docs/sources/datasources/prometheus/troubleshooting/index.md
This document provides troubleshooting information for common errors you may encounter when using the Prometheus data source in Grafana.
The following errors occur when Grafana cannot establish or maintain a connection to Prometheus.
Error message: "There was an error returned querying the Prometheus API"
Cause: Grafana cannot establish a network connection to the Prometheus server.
Solution:
http:// or https://).9090).localhost.Error message: "context deadline exceeded" or "request timeout"
Cause: The connection to Prometheus timed out before receiving a response.
Solution:
Error message: "Failed to parse data source URL"
Cause: The URL entered in the data source configuration is not valid.
Solution:
http://localhost:9090 or https://prometheus.example.com:9090).http:// or https://).The following errors occur when there are issues with authentication credentials or permissions.
Error message: "401 Unauthorized" or "Authorization failed"
Cause: The authentication credentials are invalid or missing.
Solution:
Error message: "403 Forbidden" or "Access denied"
Cause: The authenticated user does not have permission to access the requested resource.
Solution:
The following errors occur when there are issues with PromQL syntax or query execution.
Error message: "parse error: unexpected character" or "bad_data: 1:X: parse error"
Cause: The PromQL query contains invalid syntax.
Alternative cause: A proxy between Grafana and Prometheus requires authentication. When proxy authentication fails, the proxy redirects the request to an HTML authentication page. Grafana cannot parse the HTML response, which results in a parse error. This appears to be a query issue but is actually a proxy authentication issue.
Solution:
Symptom: The query returns no data and the visualization is empty.
Cause: The specified metric does not exist in Prometheus, or there is no data for the selected time range.
Solution:
/api/v1/label/__name__/values.Error message: "query timed out in expression evaluation" or "query processing would load too many samples"
Cause: The query took longer than the configured timeout limit or would return too many samples.
Solution:
sum(), avg(), or rate() to reduce the number of time series.query.timeout or query.max-samples settings in Prometheus if you have admin access.Error message: "exceeded maximum resolution of 11,000 points per timeseries" or "maximum number of series limit exceeded"
Cause: The query is returning more time series or data points than the configured limits allow.
Solution:
Error message: "unknown function" or "parse error: unexpected aggregation"
Cause: The query uses an invalid or unsupported PromQL function.
Solution:
The following errors occur when the data source is not configured correctly.
Error message: Unexpected behavior when querying metrics or labels
Cause: The Prometheus type setting does not match your actual Prometheus-compatible database.
Solution:
Symptom: Data appears sparse, or rate() queries return no data or incomplete results.
Cause: The Scrape interval setting in Grafana does not match the actual scrape interval in Prometheus. This especially affects rate() queries, which require at least two data points within the specified time window. For example, if your actual scrape interval is 5 minutes but Grafana uses the default (15 seconds for OSS, 1 minute for Grafana Cloud), a query like rate(http_requests_total[1m]) returns no data because there are no data points within that 1-minute window.
Solution:
scrape_interval setting.$__rate_interval instead of hardcoded time windows in rate() queries. This variable automatically adjusts based on your scrape interval.The following errors occur when there are issues with TLS configuration.
Error message: "x509: certificate signed by unknown authority" or "certificate verify failed"
Cause: Grafana cannot verify the TLS certificate presented by Prometheus.
Solution:
Error message: "TLS: handshake failure" or "connection reset"
Cause: The TLS handshake between Grafana and Prometheus failed.
Solution:
The following issues don't produce specific error messages but are commonly encountered.
Cause: The query returns no data.
Solution:
Cause: Queries take a long time to execute.
Solution:
Cause: The visualization doesn't show the most recent data.
Solution:
rate() and similar functions, remember that they need at least two data points to calculate.Cause: Exemplar data is not appearing in visualizations.
Solution:
Cause: Prometheus alerting rules are not appearing in the Grafana Alerting UI.
Solution:
If you continue to experience issues after following this troubleshooting guide: