diegosouzapw/OmniRoute · error · Error
`HTTP
Error message
`HTTP ${res.status}` What it means
Budget save sentinel: the PATCH/PUT to /api/usage/budget with the normalized limits (daily/weekly/monthly USD, warningThreshold fraction, resetInterval/resetTime — undefined keys stripped) returned non-ok, and the bare 'HTTP <status>' is thrown. The spending budget was not updated; the status code distinguishes validation (400) from auth (401/403) and server (5xx) failures.
Solutions
- Check the status: 400 usually means a limit/threshold failed server-side Zod
- Verify warningThresholdPct converts to a valid 0–1 fraction
- Correct the values and re-save the budget
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/app/(dashboard)/dashboard/usage/components/BudgetTab.tsx:357 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/b3290f817e713083.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/(dashboard)/dashboard/usage/components/BudgetTab.tsx:357
dailyLimitUsd: payload.dailyLimitUsd,
weeklyLimitUsd: payload.weeklyLimitUsd,
monthlyLimitUsd: payload.monthlyLimitUsd,
warningThreshold:
payload.warningThresholdPct !== undefined
? payload.warningThresholdPct / 100
: payload.warningThreshold,
resetInterval: payload.resetInterval,
resetTime: payload.resetTime,
};
// Strip undefined keys
Object.keys(body).forEach((k) => body[k] === undefined && delete body[k]);
const res = await fetch("/api/usage/budget", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
notify.success(t("budgetSaved"));
await loadAll();
} catch (err) {
console.error("[Budget] save failed", err);
notify.error(t("budgetSaveFailed"));
} finally {
setSaving(false);
}
},
[loadAll, notify, t]
);
const applyTemplateToSelected = useCallback(
async (template: Template) => {
if (selectedIds.size === 0) {
notify.error(t("budgetNoKeysSelected"));
return;
}View on GitHub (pinned to a179ffed5b)