different-ai/openwork · warning · Error

settings.environment.apply_no_local_workspace

Error message

settings.environment.apply_no_local_workspace

What it means

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.

Source

Thrown at apps/app/src/react-app/shell/settings-route.tsx:2215

  }, [notFoundRouteError]);
  const routeOpenworkCapabilities: OpenworkServerCapabilities | null = openworkClient
    ? ROUTE_OPENWORK_CAPABILITIES
    : null;
  const environmentRuntimeKey = buildOpenworkEnvRuntimeKey({
    baseUrl: openworkServerSnapshot.openworkServerBaseUrl || openworkServerSnapshot.openworkServerUrl,
    pid: openworkServerSnapshot.openworkServerHostInfo?.pid ?? null,
    port: openworkServerSnapshot.openworkServerHostInfo?.port ?? null,
  });

  const handleApplyEnvironmentChanges = async () => {
    if (!isDesktopRuntime()) {
      throw new Error(t("settings.environment.apply_unavailable"));
    }
    if (activeReloadBlockingSessions.length > 0) {
      throw new Error(t("settings.environment.apply_blocked_active_tasks"));
    }
    if (!selectedWorkspaceRoot) {
      throw new Error(t("settings.environment.apply_no_local_workspace"));
    }
    const workspacePaths = Array.from(
      new Set(
        workspaces.flatMap((workspace) => {
          const path = workspace.workspaceType !== "remote" ? workspace.path?.trim() ?? "" : "";
          return path ? [path] : [];
        }),
      ),
    );
    const workspacePathSet = new Set(workspacePaths);
    if (!workspacePathSet.has(selectedWorkspaceRoot)) {
      workspacePaths.unshift(selectedWorkspaceRoot);
    }
    await engineStart(selectedWorkspaceRoot, {
      preferSidecar: true,
      runtime: "direct",
      workspacePaths,
      openworkRemoteAccess: openworkServerSnapshot.openworkServerSettings.remoteAccessEnabled === true,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Select a local workspace (one with a filesystem root) before applying environment changes.
  2. Create/open a local workspace if none exists, then retry.
  3. If the workspace is remote, switch to a local one — environment application only targets local paths.

Example fix

// before
if (!selectedWorkspaceRoot) {
  throw new Error(t("settings.environment.apply_no_local_workspace"));
}
// after
if (!selectedWorkspaceRoot) {
  toast(t("settings.environment.apply_no_local_workspace"));
  return;
}
Defensive patterns

Strategy: validation

Validate before calling

const localRoot = selectedWorkspace?.workspaceType !== "remote" ? selectedWorkspace?.path?.trim() : "";
if (!localRoot) {
  showNotice(t("settings.environment.apply_no_local_workspace"));
  return;
}

Type guard

function hasLocalRoot(ws: WorkspaceInfo | null): ws is WorkspaceInfo & { path: string } {
  return ws !== null && ws.workspaceType !== "remote" && typeof ws.path === "string" && ws.path.trim().length > 0;
}

Try / catch

try {
  await handleApplyEnvironmentChanges();
} catch (e) {
  if (e instanceof Error && e.message === t("settings.environment.apply_no_local_workspace")) {
    navigateToWorkspacePicker();
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/254f361a2613f391. Report an issue: GitHub.