{"record":{"id":"f8136257383c9cb2","repo":"different-ai/openwork","slug":"select-a-workspace-to-inspect-runtime-config","errorCode":null,"errorMessage":"Select a workspace to inspect runtime config.","messagePattern":"Select a workspace to inspect runtime config\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/app/src/react-app/shell/settings-route.tsx","lineNumber":2612,"sourceCode":"          />\n        );\n      case \"advanced\":\n        return (\n          <AdvancedView\n            key={runtimeWorkspaceId ?? selectedWorkspaceId}\n            busy={busy}\n            clientConnected={Boolean(opencodeClient)}\n            opencodeConnectStatus={null}\n            openworkServerStatus={openworkServerSnapshot.openworkServerStatus}\n            developerMode={developerMode}\n            toggleDeveloperMode={toggleDeveloperMode}\n            opencodeDevModeEnabled={false}\n            openDebugDeepLink={async () => ({ ok: false, message: \"Debug deep links are not wired into the React settings route yet.\" })}\n            cloudMcpUrl={openworkCloudMcpUrl}\n            canInspectRuntimeConfig={Boolean(openworkClient && selectedWorkspaceId)}\n            getRuntimeConfigStatus={async () => {\n              if (!openworkClient || !selectedWorkspaceId) {\n                throw new Error(\"Select a workspace to inspect runtime config.\");\n              }\n              return openworkClient.getRuntimeConfigStatus(selectedWorkspaceId);\n            }}\n            cloudMcpHealth={cloudMcpHealth}\n            refreshCloudMcpHealth={refreshCloudMcpHealth}\n            organizationServer={denSession}\n          />\n        );\n      case \"appearance\":\n        return (\n          <AppearanceView\n            busy={busy}\n            themeMode={themeMode}\n            setThemeMode={setThemeModeState}\n            language={currentLocale() as Language}\n            setLanguage={setLocale}\n            hideTitlebar={hideTitlebar}\n            toggleHideTitlebar={() => setHideTitlebar((current) => !current)}","sourceCodeStart":2594,"sourceCodeEnd":2630,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/shell/settings-route.tsx#L2594-L2630","documentation":"getRuntimeConfigStatus in the settings route requires both an initialized openworkClient and a selectedWorkspaceId; canInspectRuntimeConfig gates the UI on the same condition. If the getter is invoked despite either being missing, it throws to prevent calling getRuntimeConfigStatus with an undefined workspace id.","triggerScenarios":"Invoking the runtime-config inspector with no workspace selected (selectedWorkspaceId null/empty) or before the OpenWork client has been created (server not connected).","commonSituations":"Opening the runtime-config panel before choosing a workspace; a workspace deselect racing the panel open; server disconnect nulling openworkClient while the panel stays mounted.","solutions":["Select a workspace in Settings before inspecting runtime config.","Reconnect the server so openworkClient is initialized, then retry.","Guard the panel behind canInspectRuntimeConfig so the getter is only called when a client and workspace exist."],"exampleFix":"// before\ngetRuntimeConfigStatus={async () => {\n  if (!openworkClient || !selectedWorkspaceId) {\n    throw new Error(\"Select a workspace to inspect runtime config.\");\n  }\n  return openworkClient.getRuntimeConfigStatus(selectedWorkspaceId);\n}}\n// after\ngetRuntimeConfigStatus={async () => {\n  if (!openworkClient) await reconnectServer();\n  if (!selectedWorkspaceId) { toast(\"Select a workspace to inspect runtime config.\"); return null; }\n  return openworkClient.getRuntimeConfigStatus(selectedWorkspaceId);\n}}","handlingStrategy":"type-guard","validationCode":"const inspectable = Boolean(openworkClient && selectedWorkspaceId);\nif (!inspectable) return null; // render picker/empty state instead of calling the getter","typeGuard":"function runtimeConfigReady(c: unknown, id: string | null | undefined)\n  : c is { getRuntimeConfigStatus: (id: string) => Promise<RuntimeConfigStatus> } {\n  return typeof c === \"object\" && c !== null && typeof id === \"string\" && id.length > 0\n    && \"getRuntimeConfigStatus\" in c;\n}","tryCatchPattern":"try {\n  const status = await getRuntimeConfigStatus();\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"Select a workspace\")) {\n    setInspectorState(\"no-workspace\");\n  } else throw e;\n}","preventionTips":["Keep canInspectRuntimeConfig as the single gate and honor it in the UI.","Never invoke getRuntimeConfigStatus with an empty workspace id.","Reset inspector state when workspace selection changes.","Re-create openworkClient on reconnect and re-render dependents."],"tags":["workspace-selection","runtime-config","precondition"],"backgroundTag":"workspace-not-connected","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}