different-ai/openwork · warning · Error

settings.environment.apply_unavailable

Error message

settings.environment.apply_unavailable

What it means

handleApplyEnvironmentChanges only supports applying environment changes in the desktop runtime, where the app can mutate the local environment and reload the server. In the web runtime the i18n key settings.environment.apply_unavailable is thrown to signal the operation is not supported there.

Source

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

      notifyAlert({
        kind: "system",
        title: notFoundRouteError,
        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);

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Use the OpenWork desktop app to apply environment changes.
  2. In web deployments, hide/disable the apply-environment control instead of invoking it.
  3. Set environment variables directly on the web server host and restart it.

Example fix

// before
const handleApplyEnvironmentChanges = async () => {
  if (!isDesktopRuntime()) throw new Error(t("settings.environment.apply_unavailable"));
// after
const handleApplyEnvironmentChanges = async () => {
  if (!isDesktopRuntime()) { toast(t("settings.environment.apply_unavailable")); return; }
Defensive patterns

Strategy: validation

Validate before calling

if (!isDesktopRuntime()) {
  showNotice(t("settings.environment.apply_unavailable"));
  return; // do not call handleApplyEnvironmentChanges
}

Type guard

const isDesktop = (): boolean => isDesktopRuntime(); // narrow runtime before enabling apply UI

Try / catch

try {
  await handleApplyEnvironmentChanges();
} catch (e) {
  if (e instanceof Error && e.message === t("settings.environment.apply_unavailable")) {
    // desktop-only: hide the control in web builds
  } else throw e;
}

Prevention

When it happens

Trigger: Clicking 'Apply environment changes' in Settings while the app runs in the browser (isDesktopRuntime() === false).

Common situations: Using the web/headless deployment and expecting desktop-only environment mutation; testing the settings UI without the Electron shell.

Related errors


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