{"record":{"id":"c1235b15c9a73d78","repo":"different-ai/openwork","slug":"failed-to-load-inference-settings-response-stat","errorCode":null,"errorMessage":"Failed to load inference settings (${response.status}).","messagePattern":"Failed to load inference settings \\((.+?)\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/inference-screen.tsx","lineNumber":322,"sourceCode":"  );\n  const canManageModels = access.isAdmin;\n  // OpenWork Models are a hosted OpenWork Cloud offering; self-hosted\n  // (single-org) deployments manage their own LLM providers instead.\n  const isSelfHosted = runtimeConfigLoaded && runtimeConfig.orgMode === \"single_org\";\n  const activeOrgSlug = activeOrg?.slug ?? null;\n\n  useEffect(() => {\n    if (!isSelfHosted) return;\n    router.replace(getCustomLlmProvidersRoute(activeOrgSlug));\n  }, [isSelfHosted, activeOrgSlug, router]);\n\n  async function loadStatus() {\n    setLoading(true);\n    setError(null);\n    try {\n      const { response, payload } = await requestJson(\"/v1/inference\", { method: \"GET\" }, 12000);\n      if (!response.ok) {\n        throw new Error(getErrorMessage(payload, `Failed to load inference settings (${response.status}).`));\n      }\n      const parsed = parseInferencePayload(payload);\n      if (!parsed) {\n        throw new Error(\"Inference settings response was incomplete.\");\n      }\n      setStatus(parsed);\n    } catch (loadError) {\n      setError(loadError instanceof Error ? loadError.message : \"Failed to load inference settings.\");\n    } finally {\n      setLoading(false);\n    }\n  }\n\n  useEffect(() => {\n    void loadStatus();\n  }, [orgContext?.organization.id]);\n\n  // Subscribe at the point of value: start the Stripe checkout right here","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/inference-screen.tsx#L304-L340","documentation":"loadStatus in InferenceScreen GETs /v1/inference (12s timeout) to load inference configuration. A non-OK response throws `Failed to load inference settings (${response.status})` unless the payload provides a message via getErrorMessage. Even on 2xx, if parseInferencePayload can't extract the settings, a separate \"Inference settings response was incomplete.\" error is thrown. Errors are shown via setError in the UI.","triggerScenarios":"GET /v1/inference returns 401 (expired session), 403 (insufficient permissions), 404 (Den version without the endpoint), 5xx (backend error), or times out at 12s. Distinct from the payload-shape failure, which yields the \"incomplete\" message instead.","commonSituations":"Idle dashboard with expired Den session; member-role user opening inference settings that need admin; older self-hosted Den lacking /v1/inference; Den API briefly unavailable during deploy or restart.","solutions":["Note the status and match it in Den server logs for GET /v1/inference; resolve the server-side cause.","On 401, sign out/in to refresh the Den session and reload the screen.","On 403, obtain the org role required for viewing/changing inference settings.","On 404, upgrade the self-hosted Den server to a version with /v1/inference.","For 5xx or timeouts, check Den service health/connectivity and retry."],"exampleFix":"// before\nconst { response, payload } = await requestJson(\"/v1/inference\", { method: \"GET\" }, 12000);\n// expired session -> 401 -> \"Failed to load inference settings (401).\"\n\n// after: refresh auth before loading\nawait refreshDenSession();\nawait loadStatus(); // 200 -> parseInferencePayload succeeds","handlingStrategy":"try-catch","validationCode":"if (!denSessionActive()) await refreshSession(); // avoid predictable 401 before loadStatus()","typeGuard":"function isHttpError(e: unknown): e is Error & { status?: number } {\n  return e instanceof Error && /\\(\\d{3}\\)/.test(e.message);\n}","tryCatchPattern":"try {\n  await loadStatus();\n} catch (e) {\n  if (isHttpError(e) && e.message.includes(\"401\")) {\n    promptReSignIn();\n  } else {\n    showError(e instanceof Error ? e.message : \"Failed to load inference settings.\");\n  }\n}","preventionTips":["Refresh the Den session before data loads in long-lived dashboards.","Check role permissions before showing the inference screen.","Keep self-hosted Den current so /v1/inference exists.","Retry once with backoff on transient 5xx or the 12s timeout."],"tags":["network","http","api","react"],"backgroundTag":"http-request-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}