different-ai/openwork · warning

settings.environment.apply_blocked_active_tasks

settings.environment.apply_blocked_active_tasks

Error message

t("settings.environment.apply_blocked_active_tasks")

What it means

handleApplyEnvironmentChanges (session-route.tsx:642) refuses to apply environment variable changes while sessions are still running. activeReloadBlockingSessions lists sessions whose tasks would be disrupted by reloading the workspace engine, so the UI throws this localized error instead of silently restarting under active work. It is a deliberate guard, not a malfunction.

Source

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

    onError: setRouteError,
    refreshRouteState,
  });

  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. Stop or wait for the active sessions listed as blocking reload, then click Apply again
  2. Open each blocking session and cancel its running task if the new env vars are urgent
  3. Restart the app after stopping tasks so the environment is picked up on startup
Defensive patterns

Strategy: validation

Validate before calling

if (activeReloadBlockingSessions.length > 0) {
  // surface a notice instead of calling apply
  notify("Stop active tasks before applying environment changes.");
  return;
}
await handleApplyEnvironmentChanges();

Try / catch

try {
  await handleApplyEnvironmentChanges();
} catch (e) {
  if (String(e.message).includes("apply_blocked_active_tasks")) {
    showBlockingSessionsDialog(activeReloadBlockingSessions);
  }
}

Prevention

When it happens

Trigger: Clicking 'Apply' on the Environment settings panel while activeReloadBlockingSessions.length > 0 — i.e. one or more sessions have running agent tasks that block an engine reload.

Common situations: A user edits env vars in Settings while a long-running coding task is executing in another session/tab; the apply is blocked until those tasks finish or are stopped. Common with background agents, scheduled automations, or a stuck session that never finishes.

Related errors


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