different-ai/openwork · warning

settings.environment.apply_no_local_workspace

settings.environment.apply_no_local_workspace

Error message

t("settings.environment.apply_no_local_workspace")

What it means

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.

Source

Thrown at apps/app/src/react-app/shell/session-route.tsx:650

  const environmentRuntimeKey = useMemo(
    () => buildOpenworkEnvRuntimeKey({
      baseUrl: client?.baseUrl ?? null,
      pid: openworkServerHostInfoState?.pid ?? null,
      port: openworkServerHostInfoState?.port ?? null,
    }),
    [client?.baseUrl, openworkServerHostInfoState?.pid, openworkServerHostInfoState?.port],
  );

  const handleApplyEnvironmentChanges = useCallback(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 reloaded = await reloadWorkspaceEngineFromUi();
    if (!reloaded) {
      throw new Error(t("app.error_connect_first"));
    }
  }, [activeReloadBlockingSessions.length, reloadWorkspaceEngineFromUi, selectedWorkspaceRoot]);

  const shareWorkspaceState = useShareWorkspaceState({
    workspaces,
    openworkServerHostInfo: openworkServerHostInfoState,
    openworkServerSettings,
    engineInfo: routeEngineInfo,
    exportWorkspaceBusy: false,
    openLink: (url) => platform.openLink(url),
    workspaceLabel,
  });

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Open/select a local workspace folder first, then apply environment changes
  2. If you only use remote workspaces, note that env apply applies to the local runtime — connect a local workspace
  3. Restart the app if the workspace root should be set but is not (stale state)
Defensive patterns

Strategy: validation

Validate before calling

if (!selectedWorkspaceRoot) {
  notify("Open a local workspace before applying environment changes.");
  return;
}
await handleApplyEnvironmentChanges();

Type guard

const hasWorkspaceRoot = (r: string | null | undefined): r is string =>
  typeof r === "string" && r.length > 0;

Try / catch

try {
  await handleApplyEnvironmentChanges();
} catch (e) {
  if (String(e.message).includes("apply_no_local_workspace")) {
    openWorkspacePicker();
  }
}

Prevention

When it happens

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

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

Related errors


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