apache/superset · error · InvalidPostProcessingError

`operation` property of post processing object undefined

Error message

`operation` property of post processing object undefined

What it means

InvalidPostProcessingError raised in QueryObject.get_post_processing_df (query_object.py:544) when an entry in the post_processing list has no truthy operation key. Each post-processing step must be an object like {"operation": "pivot", "options": {...}}; without an operation name Superset cannot dispatch to the pandas_postprocessing module. This is a malformed-request error detected while applying pandas post-processing to the DataFrame returned by the database.

Source

Thrown at superset/common/query_object.py:544

            )
        return cache_key

    def exec_post_processing(self, df: DataFrame) -> DataFrame:
        """
        Perform post processing operations on DataFrame.

        :param df: DataFrame returned from database model.
        :return: new DataFrame to which all post processing operations have been
                 applied
        :raises QueryObjectValidationError: If the post processing operation
                 is incorrect
        """
        logger.debug("post_processing: \n %s", pformat(self.post_processing))
        with event_logger.log_context(f"{self.__class__.__name__}.post_processing"):
            for post_process in self.post_processing:
                operation = post_process.get("operation")
                if not operation:
                    raise InvalidPostProcessingError(
                        _("`operation` property of post processing object undefined")
                    )
                if not hasattr(pandas_postprocessing, operation):
                    raise InvalidPostProcessingError(
                        _(
                            "Unsupported post processing operation: %(operation)s",
                            type=operation,
                        )
                    )
                options = post_process.get("options", {})
                df = getattr(pandas_postprocessing, operation)(df, **options)
            return df

View on GitHub (pinned to f4587218dd)

Solutions

  1. Print/inspect the post_processing array in the failing chart's formData and add the missing "operation" field (valid values are function names in superset/common/utils/pandas_postprocessing.py, e.g. pivot, aggregate, rolling, diff, rank, cum, contribution, proscons, boxplot).
  2. Validate each post-processing entry client-side against a schema requiring operation:string before sending the request.
  3. If the chart was authored in an older Superset version, re-save the chart in the current Explore UI so the stored post_processing is regenerated.

Example fix

// before
"post_processing": [
  { "options": { "aggregate": { "sum__sales": "sum" } } }
]

// after
"post_processing": [
  {
    "operation": "aggregate",
    "options": { "aggregate": { "sum__sales": "sum" } }
  }
]
Defensive patterns

Strategy: validation

Validate before calling

def validate_post_processing(steps: list[dict]) -> None:
    for i, step in enumerate(steps or []):
        if not isinstance(step, dict) or not step.get("operation"):
            raise ValueError(f"post_processing[{i}] is missing 'operation'")

Type guard

from typing import TypedDict

class PostProcessingStep(TypedDict):
    operation: str
    options: dict

def is_valid_post_processing_step(step: object) -> bool:
    return (
        isinstance(step, dict)
        and isinstance(step.get("operation"), str)
        and bool(step["operation"].strip())
    )

Try / catch

from superset.exceptions import InvalidPostProcessingError

try:
    df = query_object.get_post_processing_df(df)
except InvalidPostProcessingError as ex:
    logger.error("bad post_processing payload: %s", query_object.post_processing)
    raise

Prevention

When it happens

Trigger: Sending a chart data request whose post_processing array contains an entry missing the operation key, e.g. {"options": {...}} or an empty object, or where operation is null/empty string. Common when post-processing payloads are assembled dynamically or hand-written.

Common situations: Custom chart plugins emitting malformed post_processing; API clients copying partial JSON from docs; version upgrades where the expected post-processing schema changed and stale stored definitions omit the operation key.

Related errors


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