apache/superset · error · AlertQueryInvalidTypeError

Alert query returned a non-number value.

Error message

Alert query returned a non-number value.

What it means

Error "Alert query returned a non-number value." thrown in apache/superset.

Source

Thrown at superset/commands/report/alert.py:166

                )
            )

    def _validate_operator(self, rows: np.recarray[Any, Any]) -> None:
        self._validate_result(rows)

        if rows[0][1] is None or pd.isna(rows[0][1]):
            self._result = None
            self._info_message = "Query returned NULL value"
            return

        if rows[0][1] == 0:
            self._result = 0.0
            return
        try:
            self._result = float(rows[0][1])
            return
        except (AssertionError, TypeError, ValueError) as ex:
            raise AlertQueryInvalidTypeError() from ex

    @property
    def _is_validator_not_null(self) -> bool:
        return (
            self._report_schedule.validator_type == ReportScheduleValidatorType.NOT_NULL
        )

    @property
    def _is_validator_operator(self) -> bool:
        return (
            self._report_schedule.validator_type == ReportScheduleValidatorType.OPERATOR
        )

    def _get_alert_metadata_from_object(self) -> dict[str, Any]:
        return {
            "report_schedule_id": self._report_schedule.id,
            "execution_id": self._execution_id,
        }

View on GitHub (pinned to f4587218dd)

Solutions

  1. Cast or transform the alert query result to a numeric value before comparing with the threshold.

When it happens

Trigger: The alert query returns a non-numeric value that cannot be compared to the threshold.

Common situations: Executing an alert whose query result value is not numeric, so threshold comparison is impossible.


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/02e0681c484e5115. Report an issue: GitHub.