{"record":{"id":"254f361a2613f391","repo":"different-ai/openwork","slug":"settings-environment-apply-no-local-workspace-254f36","errorCode":null,"errorMessage":"settings.environment.apply_no_local_workspace","messagePattern":"settings\\.environment\\.apply_no_local_workspace","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/app/src/react-app/shell/settings-route.tsx","lineNumber":2215,"sourceCode":"  }, [notFoundRouteError]);\n  const routeOpenworkCapabilities: OpenworkServerCapabilities | null = openworkClient\n    ? ROUTE_OPENWORK_CAPABILITIES\n    : null;\n  const environmentRuntimeKey = buildOpenworkEnvRuntimeKey({\n    baseUrl: openworkServerSnapshot.openworkServerBaseUrl || openworkServerSnapshot.openworkServerUrl,\n    pid: openworkServerSnapshot.openworkServerHostInfo?.pid ?? null,\n    port: openworkServerSnapshot.openworkServerHostInfo?.port ?? null,\n  });\n\n  const handleApplyEnvironmentChanges = 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 workspacePaths = Array.from(\n      new Set(\n        workspaces.flatMap((workspace) => {\n          const path = workspace.workspaceType !== \"remote\" ? workspace.path?.trim() ?? \"\" : \"\";\n          return path ? [path] : [];\n        }),\n      ),\n    );\n    const workspacePathSet = new Set(workspacePaths);\n    if (!workspacePathSet.has(selectedWorkspaceRoot)) {\n      workspacePaths.unshift(selectedWorkspaceRoot);\n    }\n    await engineStart(selectedWorkspaceRoot, {\n      preferSidecar: true,\n      runtime: \"direct\",\n      workspacePaths,\n      openworkRemoteAccess: openworkServerSnapshot.openworkServerSettings.remoteAccessEnabled === true,","sourceCodeStart":2197,"sourceCodeEnd":2233,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/shell/settings-route.tsx#L2197-L2233","documentation":"Applying environment changes computes the set of local workspace paths to update. If selectedWorkspaceRoot is empty — no local workspace is selected or it has no root path — there is nothing to apply, so the settings.environment.apply_no_local_workspace message is thrown.","triggerScenarios":"Clicking 'Apply environment changes' on desktop with no workspace selected, or the selected workspace is remote (no local root path) or its path is blank.","commonSituations":"Fresh install with zero workspaces; user selected a remote workspace which has no local root; workspace added without a path so `path?.trim()` is empty.","solutions":["Select a local workspace (one with a filesystem root) before applying environment changes.","Create/open a local workspace if none exists, then retry.","If the workspace is remote, switch to a local one — environment application only targets local paths."],"exampleFix":"// before\nif (!selectedWorkspaceRoot) {\n  throw new Error(t(\"settings.environment.apply_no_local_workspace\"));\n}\n// after\nif (!selectedWorkspaceRoot) {\n  toast(t(\"settings.environment.apply_no_local_workspace\"));\n  return;\n}","handlingStrategy":"validation","validationCode":"const localRoot = selectedWorkspace?.workspaceType !== \"remote\" ? selectedWorkspace?.path?.trim() : \"\";\nif (!localRoot) {\n  showNotice(t(\"settings.environment.apply_no_local_workspace\"));\n  return;\n}","typeGuard":"function hasLocalRoot(ws: WorkspaceInfo | null): ws is WorkspaceInfo & { path: string } {\n  return ws !== null && ws.workspaceType !== \"remote\" && typeof ws.path === \"string\" && ws.path.trim().length > 0;\n}","tryCatchPattern":"try {\n  await handleApplyEnvironmentChanges();\n} catch (e) {\n  if (e instanceof Error && e.message === t(\"settings.environment.apply_no_local_workspace\")) {\n    navigateToWorkspacePicker();\n  } else throw e;\n}","preventionTips":["Require a local workspace selection before showing the apply control.","Validate workspace.path is non-empty when creating local workspaces.","Explain that remote workspaces cannot receive environment changes.","Default-select a valid local workspace where possible."],"tags":["environment","workspace-selection","no-local-workspace"],"backgroundTag":"no-local-workspace-selected","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}