apache/superset · error

Unsupported aggregation type: ${type}

Error message

Unsupported aggregation type: ${type}

What it means

getAggFunc in the deck.gl layers common module builds a d3 aggregation function from a fd aggregation string. It first checks a fixed percentile map (median, quantile-like keys), then the d3functions table (min/max/sum/mean/etc.); anything else throws 'Unsupported aggregation type'. This is config validation for color/size aggregation on deck.gl layers.

Source

Thrown at superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx:194

      let sortedArr;
      if (accessor) {
        sortedArr = arr.sort((o1: JsonObject, o2: JsonObject) =>
          d3ascending(accessor(o1), accessor(o2)),
        );
      } else {
        sortedArr = arr.sort(d3ascending);
      }

      return d3quantile(
        sortedArr,
        percentiles[type as keyof typeof percentiles],
        acc,
      );
    };
  } else if (type in d3functions) {
    d3func = d3functions[type];
  } else {
    throw new Error(`Unsupported aggregation type: ${type}`);
  }

  if (!accessor) {
    return (arr: number[]) => d3func(arr);
  }

  return (arr: number[]) => d3func(arr.map(x => accessor(x)));
}

export const getColorForBreakpoints = (
  aggFunc: (arr: number[]) => number | number[] | undefined,
  point: number[],
  colorBreakpoints: ColorBreakpointType[],
) => {
  const aggResult = aggFunc(point);

  if (aggResult === undefined) return undefined;

View on GitHub (pinned to f4587218dd)

Solutions

  1. Set the aggregation control to one of the supported values (min, max, sum, mean, median, p75/p90/p99-style percentiles exposed by the control).
  2. Fix the form_data string: correct the typo or map the custom aggregation to a supported one.
  3. If a distinct count is needed, precompute it as a metric in the dataset and aggregate with sum/mean instead.
  4. Search the chart JSON (GET /api/v1/chart) for the offending string to locate which control produced it.

Example fix

// before
"color_picker": { "aggregation": "count_distinct" }

// after
"color_picker": { "aggregation": "sum" }
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_AGGREGATIONS = new Set([
  'min', 'max', 'sum', 'mean', 'median', 'p75', 'p90', 'p99',
]);

if (!SUPPORTED_AGGREGATIONS.has(fd.aggregation)) {
  // pick a safe default before rendering
  fd.aggregation = 'sum';
}

Type guard

function isSupportedAggregation(v: unknown): v is string {
  return typeof v === 'string' && SUPPORTED_AGGREGATIONS.has(v);
}

Try / catch

const aggFunc = isSupportedAggregation(fd.aggregation)
  ? getAggFunc(fd.aggregation, accessor)
  : getAggFunc('sum', accessor); // fallback aggregate

Prevention

When it happens

Trigger: A deck.gl chart whose form_data aggregation (e.g. fd.color_picker aggregation or spatial aggregation) is a string outside percentiles and d3functions — typo like 'avarage', a SQL aggregate like 'count_distinct', or a localization artifact.

Common situations: Hand-edited or imported chart JSON with a custom aggregation name; form_data copied from a non-deckgl chart; older dashboards referencing aggregations removed in a refactor.

Related errors


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