{"record":{"id":"43ccee91222eee70","repo":"diegosouzapw/OmniRoute","slug":"body-error-http-response-status","errorCode":null,"errorMessage":"body.error || `HTTP ${response.status}`","messagePattern":"body\\.error \\|\\| `HTTP (.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/usage/components/ProviderLimits/ProviderUsdCostModal.tsx","lineNumber":102,"sourceCode":"  const [payload, setPayload] = useState<ProviderWindowCostPayload | null>(null);\n  const [loading, setLoading] = useState(false);\n  const [error, setError] = useState<string | null>(null);\n  const [simulatedPercent, setSimulatedPercent] = useState(25);\n\n  useEffect(() => {\n    if (!isOpen || !connection?.provider) return;\n    let alive = true;\n\n    async function load() {\n      setLoading(true);\n      setError(null);\n      try {\n        const params = new URLSearchParams({ provider: String(connection.provider) });\n        if (connection.id) params.set(\"connectionId\", String(connection.id));\n        const response = await fetch(`/api/usage/provider-window-costs?${params.toString()}`);\n        if (!response.ok) {\n          const body = await response.json().catch(() => ({}));\n          throw new Error(body.error || `HTTP ${response.status}`);\n        }\n        const data = (await response.json()) as ProviderWindowCostPayload;\n        if (alive) setPayload(data);\n      } catch (loadError) {\n        if (alive) {\n          setError(loadError instanceof Error ? loadError.message : t(\"loadUsdCostsFailed\"));\n          setPayload(null);\n        }\n      } finally {\n        if (alive) setLoading(false);\n      }\n    }\n\n    void load();\n    return () => {\n      alive = false;\n    };\n  }, [isOpen, connection?.id, connection?.provider, t]);","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/ProviderUsdCostModal.tsx#L84-L120","documentation":"The Provider USD cost modal failed to load window-cost data from the internal dashboard endpoint. The async load() checks response.ok; when it fails it prefers the JSON body's error.message and falls back to a generic 'HTTP <status>' string when the body carries no error field (e.g. empty or non-JSON error responses).","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/usage/components/ProviderLimits/ProviderUsdCostModal.tsx:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the dashboard endpoint for the provider/connection and confirm it returns a JSON body with an error.message on failure","Retry the modal after verifying the OmniRoute server is healthy and the provider connection exists","If only 'HTTP <status>' is shown, inspect the server logs for the matching status to find the real cause"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}