apache/superset · error · QueryObjectValidationError

Invalid result type: %(result_type)s

Error message

Invalid result type: %(result_type)s

What it means

In _get_result execution dispatch, after checking the metadata result-type registry, an unknown result_type string raises QueryObjectValidationError('Invalid result type: %(result_type)s'). Valid values are the keys of _metadata_result_type_functions and _data_result_type_preparers (e.g. 'results', 'samples', 'full', and the metadata types like 'col_form','metrics_list', etc., varying by version).

Source

Thrown at superset/common/query_actions.py:358

    query_context: QueryContext,
    query_obj: QueryObject,
    force_cached: bool,
) -> QueryDataResult:
    """
    Return result payload and timing without storing timing in the payload.

    The total interval begins before result-family preparation and dispatch.
    Metadata result types do not acquire dataframe state, so their phase values
    are null while the measured total remains available.
    """
    started_ns = time.perf_counter_ns()
    if result_func := _metadata_result_type_functions.get(result_type):
        payload = result_func(query_context, query_obj, force_cached)
        total_ns = max(0, time.perf_counter_ns() - started_ns)
        return QueryDataResult(payload=payload, timing=_metadata_timing(total_ns))

    if result_type not in _data_result_type_preparers:
        raise QueryObjectValidationError(
            _("Invalid result type: %(result_type)s", result_type=result_type)
        )

    if preparer := _data_result_type_preparers[result_type]:
        query_obj = preparer(query_context, query_obj)

    payload, acquisition_timing, action_assembly_ns = _get_full_with_timing(
        query_context,
        query_obj,
        force_cached,
    )
    total_ns = max(0, time.perf_counter_ns() - started_ns)
    return QueryDataResult(
        payload=payload,
        timing=QueryTiming(
            query_planning_ns=acquisition_timing.query_planning_ns,
            cache_resolution_ns=acquisition_timing.cache_resolution_ns,
            data_acquisition_ns=acquisition_timing.data_acquisition_ns,

View on GitHub (pinned to f4587218dd)

Solutions

  1. Check the accepted result types in the installed superset/common/query_actions.py registries and use one of those strings.
  2. Upgrade frontend/backend in lockstep so client-sent result types exist server-side.
  3. Remove custom result_type values from payloads before sending.

Example fix

# before
{"result_type": "full", ...}  # not registered on this backend

# after
{"result_type": "results", ...}  # key present in _data_result_type_preparers
Defensive patterns

Strategy: validation

Validate before calling

from superset.common import query_actions
valid = set(query_actions._metadata_result_type_functions) | set(
    query_actions._data_result_type_preparers
)
assert result_type in valid, f"unsupported result_type {result_type}"

Type guard

def is_valid_result_type(rt: str) -> bool:
    return rt in {"results", "samples", "col_form", "metrics_list"}  # verify per version

Try / catch

except QueryObjectValidationError as e:
    if "Invalid result type" in str(e):
        result_type = "results"  # safe default, retry once

Prevention

When it happens

Trigger: Submitting /api/v1/chart/data or a query context with result_type not in the supported set — e.g. 'full' vs 'results' confusion across versions, typos, or a client built against a different Superset version whose result types differ.

Common situations: Version skew between superset-ui client and backend; hand-rolled API clients; feature branches that rename result types.

Related errors


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