firefly-iii/firefly-iii · error · FireflyException
Could not render view: %s
Error message
Could not render view: %s
What it means
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.
Source
Thrown at app/Http/Controllers/Report/BudgetController.php:180
$result[$key]['sum'] = bcadd((string) $journal['amount'], $result[$key]['sum']);
$result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
$result[$key]['avg_float'] = (float) $result[$key]['avg']; // intentional float
}
}
}
// sort by amount_float
// sort temp array by amount.
$amounts = array_column($result, 'avg_float');
array_multisort($amounts, SORT_ASC, $result);
try {
$result = view('reports.budget.partials.avg-expenses', ['result' => $result])->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
Log::error($e->getTraceAsString());
throw new FireflyException($result, 0, $e);
}
return $result;
}
/**
* @return Factory|View
*/
public function budgets(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Factory|\Illuminate\Contracts\View\View
{
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
$sums = [];
$report = [];
/** @var Budget $budget */
foreach ($budgets as $budget) {
$budgetId = $budget->id;
$report[$budgetId] ??= ['name' => $budget->name, 'id' => $budget->id, 'currencies' => []];View on GitHub (pinned to fd8791d08d)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
use Illuminate\Support\Facades\View;
if (!View::exists('reports.budget.partials.avg-expenses')) {
// leave the average-expenses block out of the report
} Try / catch
try {
$avg = $controller->avgExpenses($accounts, $start, $end);
} catch (FireflyException $e) {
// message already embeds the original render error
Log::warning('avg-expenses block failed: ' . $e->getMessage());
$avg = null;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Version-skewed instances after incomplete upgrades; customized budget report partials; stale view cache after pulling a new Docker image.
Related errors
- Could not render view.
- Could not render view.
- Could not render view.
- Could not render view.
- Could not render view.
AI-assisted analysis of firefly-iii/firefly-iii@fd8791d08d (2026-08-17).
Data as JSON: /api/errors/0505153aacd88713.
Report an issue: GitHub.