{"record":{"id":"74c84d4eb77954d9","repo":"perspective-dev/perspective","slug":"unknown-aggregate-agg-name","errorCode":null,"errorMessage":"Unknown aggregate '{agg_name}'","messagePattern":"Unknown aggregate '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"rust/perspective-python/perspective/virtual_servers/polars.py","lineNumber":364,"sourceCode":"            mask = mask & (col_expr <= value)\n\n    return df.filter(mask)\n\n\ndef get_polars_agg_expr(col, agg_name, filter_expr=None):\n    \"\"\"Convert an aggregate name to a Polars expression.\"\"\"\n    if isinstance(agg_name, list):\n        agg_name = agg_name[0]\n    if isinstance(agg_name, dict):\n        agg_name = \"first\"\n    expr = pl.col(col)\n    if filter_expr is not None:\n        expr = expr.filter(filter_expr)\n    if agg_name in AGG_MAP:\n        return AGG_MAP[agg_name](expr)\n\n    msg = f\"Unknown aggregate '{agg_name}'\"\n    raise ValueError(msg)\n\n\ndef default_aggregate(col_name, df):\n    \"\"\"Return the default aggregate for a column based on its type.\"\"\"\n    dtype = df[col_name].dtype\n    psp_type = polars_type_to_psp(dtype)\n    if psp_type in (\"integer\", \"float\"):\n        return \"sum\"\n    return \"count\"\n\n\ndef build_rollup(df, group_by, columns, aggregates, col_alias):\n    \"\"\"Emulate GROUP BY ROLLUP using multiple group_by operations.\"\"\"\n    n = len(group_by)\n    frames = []\n    data_columns = [c for c in columns if c not in group_by]\n\n    for level in range(n + 1):","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-python/perspective/virtual_servers/polars.py#L346-L382","documentation":"get_polars_agg_expr looks up the aggregate name in AGG_MAP to build a Polars expression; names outside the map (typos like \"mean\" vs \"avg\", or client-sent invalid config from a view request) cannot be translated, so the rollup/group-by pipeline raises ValueError before any computation runs.","triggerScenarios":"Thrown at rust/perspective-python/perspective/virtual_servers/polars.py:364 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an aggregate name present in AGG_MAP (e.g. count, sum, avg, first, last)","Check the client's aggregates config for typos or aggregates unsupported by the Polars virtual server","Add the missing aggregate to AGG_MAP if it is a legitimately supported operation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}