octobercms/october · error · ApplicationException

Metric not found: $metricCode

Error message

Metric not found: $metricCode

What it means

Error "Metric not found: $metricCode" thrown in octobercms/october.

Source

Thrown at modules/dashboard/classes/ReportDataQueryBuilder.php:326

        return $wrappedQuery->count();
    }

    /**
     * getMetricTotals returns totals for metric with the metric totals or the relative bar enabled.
     * @param ReportMetricConfiguration[] $metricsConfiguration
     * @return array Returns an array of metric total values
     */
    public function getMetricTotals(array $metricsConfiguration): array
    {
        // Totals use the same query as for dimensions but without grouping or pagination.

        $metrics = [];
        foreach ($metricsConfiguration as $metricCode => $configuration) {
            if ($configuration->getDisplayTotals() || $configuration->getDisplayRelativeBar()) {
                $metric = ReportMetric::findMetricByCode($this->metrics, $metricCode);
                if (!$metric) {
                    throw new ApplicationException("Metric not found: $metricCode");
                }

                $metrics[] = $metric;
            }
        }

        if (!count($metrics)) {
            return [];
        }

        $query = $this->createQueryBuilder(true, $metrics);
        $rows = $query->get()->toArray();
        if (!count($rows)) {
            return [];
        }

        $row = $rows[0];
        $result = [];

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/dashboard/classes/ReportDataQueryBuilder.php:326 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/fe343ada72379d1f. Report an issue: GitHub.