{"record":{"id":"0505153aacd88713","repo":"firefly-iii/firefly-iii","slug":"could-not-render-view-s","errorCode":null,"errorMessage":"Could not render view: %s","messagePattern":"Could not render view: (.+?)","errorType":"exception","errorClass":"FireflyException","httpStatus":500,"severity":"error","filePath":"app/Http/Controllers/Report/BudgetController.php","lineNumber":180,"sourceCode":"                    $result[$key]['sum']       = bcadd((string) $journal['amount'], $result[$key]['sum']);\n                    $result[$key]['avg']       = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);\n                    $result[$key]['avg_float'] = (float) $result[$key]['avg']; // intentional float\n                }\n            }\n        }\n        // sort by amount_float\n        // sort temp array by amount.\n        $amounts = array_column($result, 'avg_float');\n        array_multisort($amounts, SORT_ASC, $result);\n\n        try {\n            $result = view('reports.budget.partials.avg-expenses', ['result' => $result])->render();\n        } catch (Throwable $e) {\n            Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));\n            $result = sprintf('Could not render view: %s', $e->getMessage());\n            Log::error($e->getTraceAsString());\n\n            throw new FireflyException($result, 0, $e);\n        }\n\n        return $result;\n    }\n\n    /**\n     * @return Factory|View\n     */\n    public function budgets(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Factory|\\Illuminate\\Contracts\\View\\View\n    {\n        $spent  = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);\n        $sums   = [];\n        $report = [];\n\n        /** @var Budget $budget */\n        foreach ($budgets as $budget) {\n            $budgetId = $budget->id;\n            $report[$budgetId] ??= ['name' => $budget->name, 'id' => $budget->id, 'currencies' => []];","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/firefly-iii/firefly-iii/blob/fd8791d08d4d9e6467519a78048cd038e26b8878/app/Http/Controllers/Report/BudgetController.php#L162-L198","documentation":"Report\\BudgetController::avgExpenses renders the 'average expenses' block of the budget report via view('reports.budget.partials.avg-expenses'). A render failure is caught, logged (the log label incorrectly says 'reports.partials.budget-period' - another copy-paste log slip; the rendered view is avg-expenses), and re-thrown as FireflyException(sprintf('Could not render view: %s', $e->getMessage()), 0, $e). Unlike the plain 'Could not render view.' variants, this message embeds the original error text, so the exception itself already names the root cause.","triggerScenarios":"Opening a budget report (average expenses section) when reports/budget/partials/avg-expenses.blade.php or its includes fail: partial missing after a partial upgrade, stale compiled views, or the template calling fields the sorted $result rows (amount_float, etc.) no longer carry.","commonSituations":"Version-skewed instances after incomplete upgrades; customized budget report partials; stale view cache after pulling a new Docker image.","solutions":["Read the exception message itself - it embeds the underlying template error; details also in storage/logs/laravel.log.","Run 'php artisan view:clear && php artisan cache:clear' and reload the report.","Verify resources/views/reports/budget/partials/avg-expenses.blade.php exists and matches the running version.","If a custom template references removed fields, re-sync it with the shipped partial."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"use Illuminate\\Support\\Facades\\View;\n\nif (!View::exists('reports.budget.partials.avg-expenses')) {\n    // leave the average-expenses block out of the report\n}","typeGuard":null,"tryCatchPattern":"try {\n    $avg = $controller->avgExpenses($accounts, $start, $end);\n} catch (FireflyException $e) {\n    // message already embeds the original render error\n    Log::warning('avg-expenses block failed: ' . $e->getMessage());\n    $avg = null;\n}","preventionTips":["Run 'php artisan view:clear && php artisan cache:clear' after upgrades.","Keep budget report partials in sync with the running release; re-apply customizations after each pull.","Note the log mislabel ('budget-period' in the log, avg-expenses in reality) when triaging."],"tags":["laravel","blade","view-render","reports","budgets","firefly-iii"],"backgroundTag":"blade-view-render-error","analyzedSha":"fd8791d08d4d9e6467519a78048cd038e26b8878","analyzedAt":"2026-08-17T02:14:53.848Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}