getredash/redash · warning
No cached result found for this query.
Error message
No cached result found for this query.
What it means
Raised by QueryResultResource.get in redash/handlers/query_results.py when an API-key user (public/query API key) requests a cached result by id and the stored query_result's query_hash no longer matches the query's current query_hash — meaning the query text changed since that result was produced, so it is not a valid cached answer.
Source
Thrown at redash/handlers/query_results.py:328
query_result = None
query = None
if query_result_id:
query_result = get_object_or_404(models.QueryResult.get_by_id_and_org, query_result_id, self.current_org)
if query_id is not None:
query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
if query_result is None and query is not None and query.latest_query_data_id is not None:
query_result = get_object_or_404(
models.QueryResult.get_by_id_and_org,
query.latest_query_data_id,
self.current_org,
)
if query is not None and query_result is not None and self.current_user.is_api_user():
if query.query_hash != query_result.query_hash:
abort(404, message="No cached result found for this query.")
if query_result:
require_access(query_result.data_source, self.current_user, view_only)
if isinstance(self.current_user, models.ApiUser):
event = {
"user_id": None,
"org_id": self.current_org.id,
"action": "api_get",
"api_key": self.current_user.name,
"file_type": filetype,
"user_agent": request.user_agent.string,
"ip": request.remote_addr,
}
if query_id:
event["object_type"] = "query"
event["object_id"] = query_idView on GitHub (pinned to ca79fe988d)
Solutions
- Re-execute the query to generate a fresh result matching the current hash, then fetch that result id.
- If you need historical results regardless of text changes, authenticate as a user API key rather than a query key.
- Keep parameter values stable between the execution that produced the result and the cached fetch.
Example fix
# before
resp = client.get('/api/query_results/999', headers={'Authorization': 'Key <query api key>'})
# after
job = client.post(f'/api/queries/{qid}/refresh', headers=user_headers)
resp = client.get(f"/api/jobs/{job['id']}") # then fetch new result id Defensive patterns
Strategy: fallback
Validate before calling
# execute the query fresh instead of relying on an old result id
job = client.post(f'/api/queries/{qid}/refresh', headers=user_headers) Try / catch
try:
resp = client.get(f'/api/query_results/{rid}', headers=h)
except HTTPError as e:
if e.response.status_code == 404 and 'cached result' in e.response.text:
resp = rerun_query_and_fetch(qid)
else:
raise Prevention
- Treat cached fetches as best-effort with a query-key auth; plan a rerun path.
- Fetch the latest_query_data_id from the query object rather than persisting old result ids.
When it happens
Trigger: GET /api/query_results/<result_id> with a query API key where the underlying query was edited after the result was generated (parameters or text change the hash).
Common situations: Embedding a live result link while the query evolves; fetching an old result id after the query was parameterized or its text updated.
Related errors
- No cached result available for query {}.
- Not found
- Invalid JWT token
- Error during query execution. Reason: {error}
- Failed running query [%s].
AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28).
Data as JSON: /api/errors/855922f8a7dcd86c.
Report an issue: GitHub.