diegosouzapw/OmniRoute · error · Error

err?.error?.message || `HTTP

Error message

err?.error?.message || `HTTP ${res.status}`

What it means

Fallback branch of the ModelLockout save error path: the PATCH failed (non-ok response) but the body had no Zod 'issues'/'details' array, so the message shown is the server's generic err.error.message or, failing that, the raw 'HTTP <status>' sentinel. It means the save was rejected without structured validation details — typically an unexpected server error or auth failure.

Solutions

  1. Use the HTTP status to classify: 401/403 auth, 5xx server-side — check server logs
  2. If err.error.message is present it is the server's sanitized reason; follow it
  3. Retry the save once the underlying cause is resolved
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/settings/components/ModelLockoutCard.tsx:180 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/bd7641f7072e9f78. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/settings/components/ModelLockoutCard.tsx:180

        const err = await res.json().catch(() => null);
        const issues = err?.error?.issues ?? err?.error?.details;
        if (Array.isArray(issues) && issues.length > 0) {
          const fieldLabels: Record<string, string> = {
            "modelLockout.baseCooldownMs": t("modelLockoutBaseCooldown"),
            "modelLockout.maxCooldownMs": t("modelLockoutMaxCooldown"),
            "modelLockout.maxBackoffSteps": t("modelLockoutMaxBackoffSteps"),
            "modelLockout.errorCodes": t("modelLockoutErrorCodes"),
          };
          const msg = issues
            .map(
              (d: { path?: (string | number)[]; message?: string }) =>
                `${fieldLabels[String(d.path?.[0])] || String(d.path?.[0] || "")}: ${d.message}`
            )
            .filter(Boolean)
            .join("\n");
          if (msg) throw new Error(msg);
        }
        throw new Error(err?.error?.message || `HTTP ${res.status}`);
      }
      const json = await res.json();
      const raw = (json as Record<string, unknown>).modelLockout as
        Record<string, unknown> | undefined;
      if (raw) {
        setData({
          enabled: typeof raw.enabled === "boolean" ? raw.enabled : saveDraft.enabled,
          errorCodes: Array.isArray(raw.errorCodes)
            ? [...(raw.errorCodes as number[])].sort((a, b) => a - b)
            : [...saveDraft.errorCodes].sort((a, b) => a - b),
          baseCooldownMs:
            typeof raw.baseCooldownMs === "number" ? raw.baseCooldownMs : saveDraft.baseCooldownMs,
          maxCooldownMs:
            typeof raw.maxCooldownMs === "number" ? raw.maxCooldownMs : saveDraft.maxCooldownMs,
          maxBackoffSteps:
            typeof raw.maxBackoffSteps === "number"
              ? raw.maxBackoffSteps
              : saveDraft.maxBackoffSteps,

View on GitHub (pinned to a179ffed5b)