apache/superset · error · AlertQueryMultipleRowsError
Alert query returned more than one row. %(num_rows)s rows re
Error message
Alert query returned more than one row. %(num_rows)s rows returned
What it means
Error "Alert query returned more than one row. %(num_rows)s rows returned" thrown in apache/superset.
Source
Thrown at superset/commands/report/alert.py:134
return (triggered, None)
except (KeyError, json.JSONDecodeError) as ex:
raise AlertValidatorConfigError() from ex
def _validate_not_null(self, rows: np.recarray[Any, Any]) -> None:
self._validate_result(rows)
value = rows[0][1]
# Normalize NULL/NaN to None for consistency with _validate_operator
if value is None or pd.isna(value):
self._result = None
self._info_message = "Query returned NULL value"
return
self._result = value
@staticmethod
def _validate_result(rows: np.recarray[Any, Any]) -> None:
# check if query return more than one row
if len(rows) > 1:
raise AlertQueryMultipleRowsError(
message=_(
"Alert query returned more than one row. %(num_rows)s rows returned", # noqa: E501
num_rows=len(rows),
)
)
# check if query returned more than one column
if len(rows[0]) > 2:
raise AlertQueryMultipleColumnsError(
# len is subtracted by 1 to discard pandas index column
_(
"Alert query returned more than one column. "
"%(num_cols)s columns returned",
num_cols=(len(rows[0]) - 1),
)
)
def _validate_operator(self, rows: np.recarray[Any, Any]) -> None:
self._validate_result(rows)View on GitHub (pinned to f4587218dd)
Solutions
- Rewrite the alert SQL so it returns exactly one row (e.g., add aggregation or LIMIT 1).
When it happens
Trigger: The alert query returns more than one row; alerts require a single scalar result.
Common situations: Executing an alert whose SQL query returns multiple rows; alert validators require a single-row result.
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/95ae856a78fe944f.
Report an issue: GitHub.