{"record":{"id":"aa083a3c4d7ca003","repo":"apache/superset","slug":"unsupported-aggregation-type-type","errorCode":null,"errorMessage":"Unsupported aggregation type: ${type}","messagePattern":"Unsupported aggregation type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx","lineNumber":194,"sourceCode":"      let sortedArr;\n      if (accessor) {\n        sortedArr = arr.sort((o1: JsonObject, o2: JsonObject) =>\n          d3ascending(accessor(o1), accessor(o2)),\n        );\n      } else {\n        sortedArr = arr.sort(d3ascending);\n      }\n\n      return d3quantile(\n        sortedArr,\n        percentiles[type as keyof typeof percentiles],\n        acc,\n      );\n    };\n  } else if (type in d3functions) {\n    d3func = d3functions[type];\n  } else {\n    throw new Error(`Unsupported aggregation type: ${type}`);\n  }\n\n  if (!accessor) {\n    return (arr: number[]) => d3func(arr);\n  }\n\n  return (arr: number[]) => d3func(arr.map(x => accessor(x)));\n}\n\nexport const getColorForBreakpoints = (\n  aggFunc: (arr: number[]) => number | number[] | undefined,\n  point: number[],\n  colorBreakpoints: ColorBreakpointType[],\n) => {\n  const aggResult = aggFunc(point);\n\n  if (aggResult === undefined) return undefined;\n","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset-frontend/plugins/preset-chart-deckgl/src/layers/common.tsx#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the aggregation control to one of the supported values (min, max, sum, mean, median, p75/p90/p99-style percentiles exposed by the control).","Fix the form_data string: correct the typo or map the custom aggregation to a supported one.","If a distinct count is needed, precompute it as a metric in the dataset and aggregate with sum/mean instead.","Search the chart JSON (GET /api/v1/chart) for the offending string to locate which control produced it."],"exampleFix":"// before\n\"color_picker\": { \"aggregation\": \"count_distinct\" }\n\n// after\n\"color_picker\": { \"aggregation\": \"sum\" }","handlingStrategy":"validation","validationCode":"const SUPPORTED_AGGREGATIONS = new Set([\n  'min', 'max', 'sum', 'mean', 'median', 'p75', 'p90', 'p99',\n]);\n\nif (!SUPPORTED_AGGREGATIONS.has(fd.aggregation)) {\n  // pick a safe default before rendering\n  fd.aggregation = 'sum';\n}","typeGuard":"function isSupportedAggregation(v: unknown): v is string {\n  return typeof v === 'string' && SUPPORTED_AGGREGATIONS.has(v);\n}","tryCatchPattern":"const aggFunc = isSupportedAggregation(fd.aggregation)\n  ? getAggFunc(fd.aggregation, accessor)\n  : getAggFunc('sum', accessor); // fallback aggregate","preventionTips":["Restrict the aggregation control's choices to the supported set when customizing deck.gl charts.","Validate aggregation strings when generating chart form_data programmatically.","Precompute exotic aggregates (distinct counts) as dataset metrics and use sum/mean on the frontend."],"tags":["deckgl","aggregation","form-data","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}