different-ai/openwork · error · Error

Failed to load inference settings

Error message

Failed to load inference settings (${response.status}).

What it means

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.

Solutions

  1. Note the status and match it in Den server logs for GET /v1/inference; resolve the server-side cause.
  2. On 401, sign out/in to refresh the Den session and reload the screen.
  3. On 403, obtain the org role required for viewing/changing inference settings.
  4. On 404, upgrade the self-hosted Den server to a version with /v1/inference.
  5. For 5xx or timeouts, check Den service health/connectivity and retry.

Example fix

// before
const { response, payload } = await requestJson("/v1/inference", { method: "GET" }, 12000);
// expired session -> 401 -> "Failed to load inference settings (401)."

// after: refresh auth before loading
await refreshDenSession();
await loadStatus(); // 200 -> parseInferencePayload succeeds
Defensive patterns

Strategy: try-catch

Validate before calling

if (!denSessionActive()) await refreshSession(); // avoid predictable 401 before loadStatus()

Type guard

function isHttpError(e: unknown): e is Error & { status?: number } {
  return e instanceof Error && /\(\d{3}\)/.test(e.message);
}

Try / catch

try {
  await loadStatus();
} catch (e) {
  if (isHttpError(e) && e.message.includes("401")) {
    promptReSignIn();
  } else {
    showError(e instanceof Error ? e.message : "Failed to load inference settings.");
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/c1235b15c9a73d78. Report an issue: GitHub.

Appendix: source

Thrown at ee/apps/den-web/app/(den)/dashboard/_components/inference-screen.tsx:322

  );
  const canManageModels = access.isAdmin;
  // OpenWork Models are a hosted OpenWork Cloud offering; self-hosted
  // (single-org) deployments manage their own LLM providers instead.
  const isSelfHosted = runtimeConfigLoaded && runtimeConfig.orgMode === "single_org";
  const activeOrgSlug = activeOrg?.slug ?? null;

  useEffect(() => {
    if (!isSelfHosted) return;
    router.replace(getCustomLlmProvidersRoute(activeOrgSlug));
  }, [isSelfHosted, activeOrgSlug, router]);

  async function loadStatus() {
    setLoading(true);
    setError(null);
    try {
      const { response, payload } = await requestJson("/v1/inference", { method: "GET" }, 12000);
      if (!response.ok) {
        throw new Error(getErrorMessage(payload, `Failed to load inference settings (${response.status}).`));
      }
      const parsed = parseInferencePayload(payload);
      if (!parsed) {
        throw new Error("Inference settings response was incomplete.");
      }
      setStatus(parsed);
    } catch (loadError) {
      setError(loadError instanceof Error ? loadError.message : "Failed to load inference settings.");
    } finally {
      setLoading(false);
    }
  }

  useEffect(() => {
    void loadStatus();
  }, [orgContext?.organization.id]);

  // Subscribe at the point of value: start the Stripe checkout right here

View on GitHub (pinned to 2b7df46e8a)