{"record":{"id":"fe343ada72379d1f","repo":"octobercms/october","slug":"metric-not-found-metriccode","errorCode":null,"errorMessage":"Metric not found: $metricCode","messagePattern":"Metric not found: \\$metricCode","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/dashboard/classes/ReportDataQueryBuilder.php","lineNumber":326,"sourceCode":"\n        return $wrappedQuery->count();\n    }\n\n    /**\n     * getMetricTotals returns totals for metric with the metric totals or the relative bar enabled.\n     * @param ReportMetricConfiguration[] $metricsConfiguration\n     * @return array Returns an array of metric total values\n     */\n    public function getMetricTotals(array $metricsConfiguration): array\n    {\n        // Totals use the same query as for dimensions but without grouping or pagination.\n\n        $metrics = [];\n        foreach ($metricsConfiguration as $metricCode => $configuration) {\n            if ($configuration->getDisplayTotals() || $configuration->getDisplayRelativeBar()) {\n                $metric = ReportMetric::findMetricByCode($this->metrics, $metricCode);\n                if (!$metric) {\n                    throw new ApplicationException(\"Metric not found: $metricCode\");\n                }\n\n                $metrics[] = $metric;\n            }\n        }\n\n        if (!count($metrics)) {\n            return [];\n        }\n\n        $query = $this->createQueryBuilder(true, $metrics);\n        $rows = $query->get()->toArray();\n        if (!count($rows)) {\n            return [];\n        }\n\n        $row = $rows[0];\n        $result = [];","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/dashboard/classes/ReportDataQueryBuilder.php#L308-L344","documentation":"Error \"Metric not found: $metricCode\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/dashboard/classes/ReportDataQueryBuilder.php:326 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}