different-ai/openwork · error

getInstallConfigErrorMessage(payload, response.status)

Error message

getInstallConfigErrorMessage(payload, response.status)

What it means

In the same handleGetApp flow, once /v1/install-config responds non-ok, the code throws getInstallConfigErrorMessage(payload, response.status): 404 maps to the expired/replaced-link message, otherwise the server's error message or "Could not load this install link (<status>)". Unlike install-screen.tsx, there is no special-case for unauthenticated 401 here.

Source

Thrown at ee/apps/den-web/app/(den)/_components/join-org-success.tsx:163

  async function handleGetApp() {
    setInstallBusy(true);
    setActionError(null);

    try {
      const installPageUrl = await createOrganizationInstallLink(organizationId, false);
      const token = installTokenFromPageUrl(installPageUrl);
      if (!token) {
        throw new Error("The install link response was incomplete.");
      }

      const { response, payload } = await requestJson(
        `/v1/install-config?token=${encodeURIComponent(token)}`,
        { method: "GET" },
        12000,
      );
      if (!response.ok) {
        throw new Error(getInstallConfigErrorMessage(payload, response.status));
      }

      const apiUrl = installerApiUrlFromConfig(payload);
      if (!apiUrl) {
        throw new Error("This install link returned incomplete setup details.");
      }

      const platform = detectedInstallPlatform(detected) ?? "mac-arm64";
      const href = buildInstallDownloadHref(apiUrl, platform, token);
      setDownloadHref(href);
      startInstallerDownload(href);
    } catch (error) {
      setActionError(error instanceof Error ? error.message : "Could not prepare your download.");
    } finally {
      setInstallBusy(false);
    }
  }

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. For 404: click 'Get app' again to mint a new install link (the old token is dead), or get one from the Members page.
  2. For 5xx: retry and check Den server logs.
  3. Compare with install-screen.tsx handling: add a 401 special case here if unauthenticated users should be told to sign in.

Example fix

// before
if (!response.ok) throw new Error(getInstallConfigErrorMessage(payload, response.status));
// after (optional 401 handling)
if (!response.ok) {
  if (response.status === 401) throw new Error("Sign in to your Den portal to install OpenWork.");
  throw new Error(getInstallConfigErrorMessage(payload, response.status));
}
Defensive patterns

Strategy: retry

Validate before calling

// token was just extracted; validate before the network call
if (!hasInstallToken(token)) throw new Error("Install token missing");
// optional pre-flight
// const res = await fetch(`/v1/install-config?token=${encodeURIComponent(token)}`, { method: "HEAD" });

Try / catch

try {
  await handleGetApp(orgId);
} catch (err) {
  if (err.message.includes("expired or was replaced")) {
    mintNewInstallLinkAndRetry(orgId); // 404: old token is dead
  } else if (/\(5\d\d\)/.test(err.message)) {
    retryWithBackoff();
  } else throw err;
}

Prevention

When it happens

Trigger: Non-ok status from GET /v1/install-config?token=... in the join-org flow: 404 (token expired/rotated), 400 (bad token), 401 (invalid token — not specially handled here), 5xx (server error).

Common situations: The freshly minted install link expired before the user clicked through; Den API restarted with rotated link secrets; transient 5xx during a deploy.

Related errors


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