getredash/redash · error · Exception

CloudWatch Insights Query Execution Status: {}

Error message

CloudWatch Insights Query Execution Status: {}

What it means

CloudWatch Insights run_query polls get_query_results; if the status comes back Failed, Timeout, Unknown, or Cancelled it aborts with this message embedding the terminal status. AWS accepted the query but it ended unsuccessfully.

Source

Thrown at redash/query_runner/cloudwatch_insights.py:142

                    }
                )

        return log_groups

    def run_query(self, query, user):
        logs = self._get_client()

        query = parse_query(query)
        query_id = logs.start_query(**query)["queryId"]

        elapsed = 0
        while True:
            result = logs.get_query_results(queryId=query_id)
            if result["status"] == "Complete":
                data = parse_response(result)
                break
            if result["status"] in ("Failed", "Timeout", "Unknown", "Cancelled"):
                raise Exception("CloudWatch Insights Query Execution Status: {}".format(result["status"]))
            elif elapsed > TIMEOUT:
                raise Exception("Request exceeded timeout.")
            else:
                time.sleep(POLL_INTERVAL)
                elapsed += POLL_INTERVAL

        return data, None


register(CloudWatchInsights)

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Run the same query in the AWS Console Insights editor against the same log group and region to see the error detail
  2. Check IAM permissions (logs:StartQuery, logs:GetQueryResults) and the configured region
  3. Fix the Insights query syntax (fields/filter/stats clauses)
  4. For Timeout: narrow the time range or add filters to reduce scan volume

Example fix

# before
fields @timestamp, @message | filter level = "error"

# after
fields @timestamp, @message | filter level = "error" | filter @timestamp > now() - 3600s
Defensive patterns

Strategy: try-catch

Validate before calling

# validate the Insights query is accepted before scheduling
resp = logs.start_query(logGroupName=LG, queryString=q, startTime=t0, endTime=t1)
logs.stop_query(queryId=resp['queryId'])  # immediately cancel

Try / catch

try:
    data, err = runner.run_query(q, u)
except Exception as e:
    if 'Query Execution Status' in str(e):
        status = str(e).rsplit(' ', 1)[-1]
        handle(status)  # Failed -> fix syntax, Timeout -> narrow range

Prevention

When it happens

Trigger: Running a CloudWatch Insights query whose AWS-side execution finishes with status 'Failed' (query invalid for the log group), 'Timeout', 'Cancelled', or 'Unknown'.

Common situations: Insights syntax errors that pass StartQuery validation, missing logs:GetQueryResults permissions mid-flight, empty log groups, or region mismatch.

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/836507ae3a7986cf. Report an issue: GitHub.