bytedance/deer-flow · critical

setup-status failed: ${response.status}

Error message

setup-status failed: ${response.status}

What it means

Thrown when GET /api/v1/auth/setup-status returns non-2xx. This unauthenticated probe (with AbortController timeout AUTH_REQUEST_TIMEOUT_MS) tells the login page whether initial system initialization is needed. Non-2xx means the auth router is absent/misrouted (404) or the Gateway is failing before auth runs (5xx). Note the fetch uses a relative path, so it depends on same-origin routing via nginx.

Source

Thrown at frontend/src/core/auth/setup.ts:29

  status: SetupStatusResponse | null;
};

export const setupStatusFetchInit = {
  cache: "no-store",
  credentials: "include",
} satisfies RequestInit;

export async function fetchSetupStatus(): Promise<SetupStatusResponse> {
  const controller = new AbortController();
  const timeout = setTimeout(() => controller.abort(), AUTH_REQUEST_TIMEOUT_MS);

  try {
    const response = await fetch("/api/v1/auth/setup-status", {
      ...setupStatusFetchInit,
      signal: controller.signal,
    });
    if (!response.ok) {
      throw new Error(`setup-status failed: ${response.status}`);
    }
    return (await response.json()) as SetupStatusResponse;
  } finally {
    clearTimeout(timeout);
  }
}

export function isSystemAlreadyInitializedError(data: unknown): boolean {
  return parseAuthError(data).code === "system_already_initialized";
}

export function canCreateRegularAccount(check: SetupStatusCheck): boolean {
  // registration_enabled is absent on older Gateways; treat that as allowed so
  // the signup entry only disappears when the backend actively closes it.
  return (
    check.checked &&
    check.status?.needs_setup !== true &&
    check.status?.registration_enabled !== false

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Open the app through the nginx entry point (default http://localhost:2026), not :3000 directly
  2. curl http://localhost:2026/api/v1/auth/setup-status to see the raw status returned by the proxy chain
  3. Wait for /health on the Gateway to be green, then reload the page
  4. If 404 persists, confirm the deployed backend version includes the /api/v1/auth routes

Example fix

// before
const status = await fetchSetupStatus();

// after
const status = await fetchSetupStatus().catch((e) => {
  if (e instanceof Error && e.message.startsWith('setup-status failed: 502')) {
    return retryAfterGatewayHealthy();
  }
  throw e;
});
Defensive patterns

Strategy: retry

Type guard

export function isSetupStatusError(e: unknown): e is Error {
  return e instanceof Error && e.message.startsWith('setup-status failed:');
}

Try / catch

try {
  return await fetchSetupStatus();
} catch (e) {
  if (isSetupStatusError(e) && (e.message.endsWith('502') || e.message.endsWith('503'))) {
    return await waitForGatewayThenRetry(); // bounded retries
  }
  throw e;
}

Prevention

When it happens

Trigger: Accessing the frontend directly on :3000 in a deployment where only the nginx entry :2026 routes /api to the Gateway; Gateway restarting (502); backend built without the auth v1 router; a timeout abort (fetch rejects with AbortError before this check, but slow 5xx also lands here).

Common situations: Dev workflow pointing the browser at the Next.js port instead of the nginx port; upgrading the backend across an auth API version change; corporate proxy intercepting /api/v1/*.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/efa88a68a173f9e6. Report an issue: GitHub.