different-ai/openwork · error
OpenWork workspace discovery failed (${response.status} ${re
Error message
OpenWork workspace discovery failed (${response.status} ${response.statusText || "HTTP error"}) What it means
createWorkspaceStore performs an HTTP discovery request against an OpenWork server to find workspaces. If the response is not ok (non-2xx), it throws an error embedding the HTTP status and statusText (falling back to "HTTP error"). The request includes a timeout controller, credentials omitted, and no caching.
Source
Thrown at apps/desktop/electron/workspace-store.mjs:745
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 8_000);
const headers = new Headers();
const bearerToken = String(token ?? "").trim();
const hostAuthToken = String(hostToken ?? "").trim();
if (bearerToken) headers.set("Authorization", `Bearer ${bearerToken}`);
if (hostAuthToken) headers.set("X-OpenWork-Host-Token", hostAuthToken);
try {
const electron = await import("electron").catch(() => null);
const fetcher = typeof electron?.net?.fetch === "function" ? electron.net.fetch.bind(electron.net) : fetch;
const response = await fetcher(url, {
headers,
signal: controller.signal,
credentials: "omit",
cache: "no-store",
});
if (!response.ok) {
throw new Error(`OpenWork workspace discovery failed (${response.status} ${response.statusText || "HTTP error"})`);
}
return await response.json();
} finally {
clearTimeout(timeout);
}
}
async function discoverOpenworkWorkspace({ hostUrl, token, hostToken, directory }) {
const list = await fetchOpenworkWorkspaceList(hostUrl, token, hostToken);
return selectOpenworkWorkspaceForConnection(list, directory);
}
function normalizeWorkspaceEntry(input) {
return {
id: String(input.id),
name: String(input.name ?? "Workspace"),
path: String(input.path ?? ""),
preset: String(input.preset ?? "starter"),View on GitHub (pinned to 2b7df46e8a)
Solutions
- Read the status in the message: 401/403 → refresh the OpenWork token; 404 → fix the base URL; 5xx → check server logs.
- Verify the configured OpenWork server URL is reachable: curl -i <hostUrl>/<discovery-path> with the same headers.
- Confirm the token/host pair matches the server (host restarts can invalidate tokens).
Example fix
// before openworkHostUrl: "https://den.example.com" // 404: API lives under /api // after openworkHostUrl: "https://den.example.com/api"
Defensive patterns
Strategy: retry
Validate before calling
const url = new URL(discoveryPath, openworkHostUrl);
if (url.protocol !== "https:" && url.protocol !== "http:") {
throw new Error(`Invalid OpenWork host URL: ${openworkHostUrl}`);
}
// optionally pre-flight:
// const res = await fetch(url, { method: "HEAD" }); if (!res.ok) ... Try / catch
try {
return await discoverWorkspaces({ hostUrl, token });
} catch (err) {
const m = /discovery failed \((\d+)/.exec(err.message);
const status = m ? Number(m[1]) : 0;
if (status >= 500 || status === 0) return retryWithBackoff();
if (status === 401 || status === 403) throw new Error("Refresh your OpenWork token.");
throw err;
} Prevention
- Validate the server URL (scheme, port, path) before saving it in settings.
- Rotate tokens on server restarts; surface 401 as a sign-in prompt.
- Add a health-check ping to the server before workspace discovery.
When it happens
Trigger: Any non-ok status from the discovery endpoint: 401/403 for bad or expired tokens, 404 for wrong URL path, 5xx from a broken server, 502/504 from a reverse proxy in front of the server.
Common situations: openworkHostUrl misconfigured (wrong port or path), stale openworkToken after server restart, server down while a proxy returns 502, DNS pointing at the wrong host.
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
- Failed to fetch latest-mac.yml (${response.status} ${respons
- Managed MCP outbound request exceeded the guarded redirect l
- OIDC discovery failed with ${response.status}. Enter manual
- An enterprise MCP server URL must use HTTP or HTTPS.
- OpenWork server did not report a base URL after startup.
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/6f9672411115fdec.
Report an issue: GitHub.