different-ai/openwork · warning · Error
settings.environment.apply_blocked_active_tasks
Error message
settings.environment.apply_blocked_active_tasks
What it means
Before applying environment changes the app restarts the local server, which would kill running sessions. If any sessions in activeReloadBlockingSessions are still active, the apply is blocked and this i18n message is thrown to protect in-flight agent tasks.
Source
Thrown at apps/app/src/react-app/shell/settings-route.tsx:2212
dedupeKey: "workspace-not-found",
});
}
}, [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,View on GitHub (pinned to 2b7df46e8a)
Solutions
- Wait for or stop/cancel the active sessions listed, then retry applying environment changes.
- Refresh the session list if activeReloadBlockingSessions is stale and no tasks are actually running.
- Schedule the environment change for when no sessions are active.
Example fix
// before
if (activeReloadBlockingSessions.length > 0) {
throw new Error(t("settings.environment.apply_blocked_active_tasks"));
}
// after
if (activeReloadBlockingSessions.length > 0) {
await Promise.all(activeReloadBlockingSessions.map((s) => stopSession(s.id)));
} Defensive patterns
Strategy: validation
Validate before calling
if (activeReloadBlockingSessions.length > 0) {
confirmDialog(t("settings.environment.apply_blocked_active_tasks"), {
action: () => Promise.all(activeReloadBlockingSessions.map((s) => stopSession(s.id)))
.then(() => handleApplyEnvironmentChanges()),
});
return;
} Type guard
const hasBlockingSessions = (s: Session[]) => s.length > 0; // narrow before allowing apply
Try / catch
try {
await handleApplyEnvironmentChanges();
} catch (e) {
if (e instanceof Error && e.message === t("settings.environment.apply_blocked_active_tasks")) {
promptStopActiveSessionsThenRetry();
} else throw e;
} Prevention
- Show active blocking sessions on the environment settings screen.
- Refresh session liveness before applying (drop stale entries).
- Offer one-click stop-and-apply flow.
- Warn users before starting long sessions that block environment applies.
When it happens
Trigger: Clicking 'Apply environment changes' on desktop while at least one session appears in activeReloadBlockingSessions (an active task/session that cannot survive a server reload).
Common situations: Editing environment variables while an agent session is streaming; long-running automation triggered during apply; stale session list showing finished sessions as active.
Related errors
- Missing Google OAuth configuration: ${missing.join(", ")}
- github_connector_app_not_configured
- settings.environment.apply_blocked_active_tasks
- settings.environment.apply_no_local_workspace
- app.error_connect_first
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/e3cec681c708e9d9.
Report an issue: GitHub.