octobercms/october · error · ApplicationException

Invalid metric column name:

Error message

Invalid metric column name: 

What it means

Guard in ReportDateDataSet::addMetricValuesToAggregationSet: a column being aggregated has no entry in the metric-to-aggregate-function map, meaning the column is not a recognized metric column for this data set.

Solutions

  1. Build metricAggregateFunctions covering every metric column name passed in
  2. Ensure column names match the metric data set column names exactly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/dashboard/classes/ReportDateDataSet.php:291 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/d145da9e70780c28. Report an issue: GitHub.

Appendix: source

Thrown at modules/dashboard/classes/ReportDateDataSet.php:291

            $function = $metric->getAggregateFunction();
            $result[$metric->getDataSetColumName()] = $function;
        }

        return $result;
    }

    private function addMetricValuesToAggregationSet(
        object $aggregationSet,
        array $columnNames,
        array $metricAggregateFunctions,
        object $dataPoint
    ) {
        foreach ($columnNames as $columnName) {
            $aggregatedValue = $aggregationSet->$columnName;
            $metricValue = $dataPoint->$columnName;

            if (!array_key_exists($columnName, $metricAggregateFunctions)) {
                throw new ApplicationException('Invalid metric column name: '.$columnName);
            }

            $aggregateFunction = $metricAggregateFunctions[$columnName];
            switch ($aggregateFunction) {
                case ReportMetric::AGGREGATE_COUNT:
                    if ($metricValue !== null) {
                        $aggregatedValue = $aggregatedValue === null ? 1 : $aggregatedValue + 1;
                    }
                    break;
                case ReportMetric::AGGREGATE_MAX:
                        $aggregatedValue = $aggregatedValue === null ? $metricValue : max($aggregatedValue, $metricValue);
                    break;
                case ReportMetric::AGGREGATE_MIN:
                        $aggregatedValue = $aggregatedValue === null ? $metricValue : min($aggregatedValue, $metricValue);
                    break;
                case ReportMetric::AGGREGATE_SUM:
                        $aggregatedValue = $aggregatedValue === null ? $metricValue : $aggregatedValue + $metricValue;
                    break;

View on GitHub (pinned to b608633a7e)