different-ai/openwork · error

getInstallConfigErrorMessage(payload, response.status)

Error message

getInstallConfigErrorMessage(payload, response.status)

What it means

When the /v1/install-config response is not ok and it is not the unauthenticated-401 case, fetchInstallConfig delegates to getInstallConfigErrorMessage: a 404 becomes "This install link has expired or was replaced...", and any other status becomes the payload's error message or "Could not load this install link (<status>)". The thrown message is that computed string.

Source

Thrown at ee/apps/den-web/app/(den)/_components/install-screen.tsx:167

    logoUrl,
    iconUrl,
    desktopVersion,
    distribution,
  };
}

async function fetchInstallConfig(token: string | null) {
  const path = token ? `/v1/install-config?token=${encodeURIComponent(token)}` : "/v1/me/install-config";
  const { response, payload } = await requestJson(
    path,
    { method: "GET" },
    12000,
  );
  if (!response.ok) {
    if (!token && response.status === 401) {
      throw new Error("Sign in to your Den portal to install OpenWork.");
    }
    throw new Error(getInstallConfigErrorMessage(payload, response.status));
  }
  const parsed = parseInstallConfig(payload);
  if (!parsed) {
    throw new Error("This install link returned incomplete setup details.");
  }
  return parsed;
}

function installHref(config: InstallConfig, platform: InstallPlatform, token: string | null) {
  return token
    ? buildInstallDownloadHref(config.apiUrl, platform, token)
    : buildAuthenticatedInstallDownloadHref(config.apiUrl, platform);
}

type StepState = "complete" | "active" | "pending";

const STEP_BADGE: Record<StepState, string> = {
  complete: "bg-emerald-50 text-emerald-600",

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. For 404: request a fresh install link from the workspace admin (Members page) and use the new one.
  2. For 5xx: retry later and check the Den server logs.
  3. Confirm the token in the URL is complete and not URL-truncated (special characters must stay encoded).

Example fix

// before: old token -> 404 expired
/v1/install-config?token=OLD
// after: fresh token from Members page
/v1/install-config?token=NEW
Defensive patterns

Strategy: retry

Validate before calling

// pre-check the token shape before calling the API
if (!/^[A-Za-z0-9_-]+$/.test(token ?? "")) throw new Error("Install token missing or malformed");

Try / catch

try {
  await fetchInstallConfig(token);
} catch (err) {
  if (err.message.includes("expired or was replaced")) {
    promptRequestFreshLink(); // 404 path
  } else if (/Could not load this install link \(5\d\d\)/.test(err.message)) {
    retryWithBackoff();
  } else throw err;
}

Prevention

When it happens

Trigger: Non-ok response other than the no-token 401: 404 (expired/rotated install token), 400 (malformed token), 500 (server error), network-facing proxies returning 502/503.

Common situations: Admin regenerated the install link, invalidating the old token (404); stale bookmarked install page; Den API temporarily down (5xx).

Related errors


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