{"record":{"id":"cbc06c6f63cd1d90","repo":"different-ai/openwork","slug":"openwork-server-did-not-report-a-base-url-after-st","errorCode":null,"errorMessage":"OpenWork server did not report a base URL after startup.","messagePattern":"OpenWork server did not report a base URL after startup\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"apps/desktop/electron/main.mjs","lineNumber":1378,"sourceCode":"}\n\nasync function disposeRuntimeBeforeQuit() {\n  if (runtimeDisposedForQuit || runtimeDisposeInProgress) return;\n  runtimeDisposeInProgress = true;\n  try {\n    await runtimeManager.dispose().catch(() => undefined);\n    runtimeDisposedForQuit = true;\n  } finally {\n    runtimeDisposeInProgress = false;\n  }\n}\n\nfunction assertOpenworkServerReady(info) {\n  if (!info?.running) {\n    throw new Error(\"OpenWork server did not stay running after startup.\");\n  }\n  if (!info.baseUrl) {\n    throw new Error(\"OpenWork server did not report a base URL after startup.\");\n  }\n  if (!info.ownerToken && !info.clientToken) {\n    throw new Error(\"OpenWork server did not report an access token after startup.\");\n  }\n  return info;\n}\n\nasync function bootRuntimeForSelectedWorkspace() {\n  if (typeof process.env.OPENWORK_EVAL_FATAL_DESKTOP_BOOTSTRAP_FAILURE === \"string\") {\n    throw new Error(process.env.OPENWORK_EVAL_FATAL_DESKTOP_BOOTSTRAP_FAILURE);\n  }\n  const list = await workspaceStore.readWorkspaceState();\n  const selectedId = list.selectedId || list.activeId || list.workspaces[0]?.id || \"\";\n  const workspace = selectedId\n    ? list.workspaces.find((entry) => entry?.id === selectedId)\n    : list.workspaces[0];\n  const workspaceRoot = String(workspace?.path ?? \"\").trim();\n  if (!workspaceRoot || workspace?.workspaceType === \"remote\") {","sourceCodeStart":1360,"sourceCodeEnd":1396,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/main.mjs#L1360-L1396","documentation":"The second check in assertOpenworkServerReady(): the server reports running but info.baseUrl is falsy. The app needs the server's HTTP base URL to route API/IPC requests; without it the server is unusable, so startup is treated as failed with this error.","triggerScenarios":"info.running is true but baseUrl is missing/empty — server started without reporting its bound address, the runtime handshake omitted baseUrl (version mismatch between runtime manager and server), or the URL was cleared when reading server state.","commonSituations":"Server bound to an ephemeral/unix socket path that wasn't surfaced as a URL; older server build not emitting baseUrl in its status payload; state file in userData missing the baseUrl field after an upgrade; race where status is read before the server announces its address.","solutions":["Ensure the bundled server version matches the runtime manager's expected status payload (baseUrl field present).","Force server state regeneration by clearing the cached server info in userData and restarting.","Retry the status read after a short delay if the server hadn't finished announcing its URL.","Log the raw server status object when baseUrl is missing to pinpoint the handshake gap."],"exampleFix":"// before\nassertOpenworkServerReady(info); // throws: no baseUrl\n// after\nif (!info?.running) throw new Error('server not running');\nif (!info.baseUrl) {\n  info = await waitFor(() => getStatus().then(s => s.baseUrl), 5_000);\n}\nassertOpenworkServerReady(info);","handlingStrategy":"validation","validationCode":"if (!info?.running) throw new Error('server not running');\nif (!info.baseUrl || !/^https?:\\/\\//.test(info.baseUrl)) {\n  throw new Error('server did not report a usable baseUrl');\n}","typeGuard":"function hasBaseUrl(info) {\n  return typeof info?.baseUrl === 'string' && info.baseUrl.length > 0;\n}","tryCatchPattern":"try {\n  assertOpenworkServerReady(info);\n} catch (err) {\n  if (String(err.message).includes('base URL')) {\n    console.error('Server running but no baseUrl — check runtime/server version handshake.');\n  } else throw err;\n}","preventionTips":["Keep the bundled server and runtime manager versions in sync.","Poll status briefly after startup before asserting readiness.","Log the raw status payload when baseUrl is missing.","Regenerate cached server state in userData after app upgrades."],"tags":["server","startup","configuration"],"backgroundTag":"missing-base-url","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}