{"record":{"id":"37a57c8787351c19","repo":"different-ai/openwork","slug":"settings-environment-apply-no-local-workspace","errorCode":"settings.environment.apply_no_local_workspace","errorMessage":"t(\"settings.environment.apply_no_local_workspace\")","messagePattern":"t\\(\"settings\\.environment\\.apply_no_local_workspace\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/app/src/react-app/shell/session-route.tsx","lineNumber":650,"sourceCode":"\n  const environmentRuntimeKey = useMemo(\n    () => buildOpenworkEnvRuntimeKey({\n      baseUrl: client?.baseUrl ?? null,\n      pid: openworkServerHostInfoState?.pid ?? null,\n      port: openworkServerHostInfoState?.port ?? null,\n    }),\n    [client?.baseUrl, openworkServerHostInfoState?.pid, openworkServerHostInfoState?.port],\n  );\n\n  const handleApplyEnvironmentChanges = useCallback(async () => {\n    if (!isDesktopRuntime()) {\n      throw new Error(t(\"settings.environment.apply_unavailable\"));\n    }\n    if (activeReloadBlockingSessions.length > 0) {\n      throw new Error(t(\"settings.environment.apply_blocked_active_tasks\"));\n    }\n    if (!selectedWorkspaceRoot) {\n      throw new Error(t(\"settings.environment.apply_no_local_workspace\"));\n    }\n    const reloaded = await reloadWorkspaceEngineFromUi();\n    if (!reloaded) {\n      throw new Error(t(\"app.error_connect_first\"));\n    }\n  }, [activeReloadBlockingSessions.length, reloadWorkspaceEngineFromUi, selectedWorkspaceRoot]);\n\n  const shareWorkspaceState = useShareWorkspaceState({\n    workspaces,\n    openworkServerHostInfo: openworkServerHostInfoState,\n    openworkServerSettings,\n    engineInfo: routeEngineInfo,\n    exportWorkspaceBusy: false,\n    openLink: (url) => platform.openLink(url),\n    workspaceLabel,\n  });\n\n","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/shell/session-route.tsx#L632-L668","documentation":"The same apply-environment handler requires a selected local workspace root before reloading the workspace engine. selectedWorkspaceRoot is null when no local workspace is open, so applying environment changes has no engine to reload and the handler throws this localized error. This is a preconditions guard in the UI.","triggerScenarios":"Clicking 'Apply' in Environment settings when no local workspace root is selected (selectedWorkspaceRoot === null), e.g. only remote/cloud workspaces are connected or no workspace has been opened yet.","commonSituations":"Fresh install with no workspace opened; user connected only remote workspaces; workspace list loaded but the local root selection was cleared after disconnecting a folder.","solutions":["Open/select a local workspace folder first, then apply environment changes","If you only use remote workspaces, note that env apply applies to the local runtime — connect a local workspace","Restart the app if the workspace root should be set but is not (stale state)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!selectedWorkspaceRoot) {\n  notify(\"Open a local workspace before applying environment changes.\");\n  return;\n}\nawait handleApplyEnvironmentChanges();","typeGuard":"const hasWorkspaceRoot = (r: string | null | undefined): r is string =>\n  typeof r === \"string\" && r.length > 0;","tryCatchPattern":"try {\n  await handleApplyEnvironmentChanges();\n} catch (e) {\n  if (String(e.message).includes(\"apply_no_local_workspace\")) {\n    openWorkspacePicker();\n  }\n}","preventionTips":["Disable the Apply action until a local workspace root is selected","Guide remote-only users to connect a local workspace first","Persist and revalidate the selected workspace root on app start"],"tags":["ui","settings","environment","workspace"],"backgroundTag":"missing-workspace-root","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}