{"record":{"id":"880a4e073dcda1f7","repo":"apache/superset","slug":"alert-query-failed-the-authorization-check","errorCode":null,"errorMessage":"Alert query failed the authorization check","messagePattern":"Alert query failed the authorization check","errorType":"exception","errorClass":"AlertQueryError","httpStatus":400,"severity":"error","filePath":"superset/commands/report/alert.py","lineNumber":247,"sourceCode":"            user = security_manager.find_user(username)\n            # A deleted/disabled executor user makes find_user return None. Raise\n            # the dedicated error so the handler below re-surfaces it instead of\n            # masking it as an opaque AlertQueryError (or letting the missing user\n            # surface as a NoneType error from the downstream auth flow).\n            if user is None:\n                raise ReportScheduleExecutorNotFoundError(username)\n\n            with override_user(user):\n                # Run table-level authorization as the executing user against\n                # the rendered SQL.\n                try:\n                    security_manager.raise_for_access(\n                        database=self._report_schedule.database,\n                        sql=rendered_sql,\n                        force_dataset_match=True,\n                    )\n                except SupersetSecurityException as ex:\n                    raise AlertQueryError(\n                        message=_(\"Alert query failed the authorization check\")\n                    ) from ex\n                start = default_timer()\n                df = self._report_schedule.database.get_df(sql=limited_rendered_sql)\n                stop = default_timer()\n                logger.info(\n                    \"Query for %s took %.2f ms\",\n                    self._execution_id,\n                    (stop - start) * 1000.0,\n                )\n                return df\n        except SoftTimeLimitExceeded as ex:\n            logger.warning(\"A timeout occurred while executing the alert query: %s\", ex)\n            raise AlertQueryTimeout() from ex\n        except ReportScheduleExecutorNotFoundError:\n            # A missing executor user is a configuration problem, not a transient\n            # query error; surface the typed error rather than masking it.\n            raise","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/report/alert.py#L229-L265","documentation":"Error \"Alert query failed the authorization check\" thrown in apache/superset.","triggerScenarios":"The alert query fails the datasource authorization check for the executor user.","commonSituations":"Executing an alert when the schedule owner lacks access to the underlying datasource.","solutions":["Grant the schedule executor user access to the database/datasource used by the alert query.","Review row-level security rules applied to the executor user."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}