different-ai/openwork · error

Select a local workspace before starting the local server/en

Error message

Select a local workspace before starting the local server/engine.

What it means

bootFullEngineStack in useDebugViewModel refuses to start the local openwork-server/engine when the settings debug view has no local workspace selected. The server must be launched with --workspace <path>, so booting without a workspace would produce a useless or broken engine stack; the view model therefore throws this guard error before spawning anything.

Source

Thrown at apps/app/src/react-app/domains/settings/state/debug-view-model.ts:711

      const target = await pickFile({ title: t("settings.custom_binary_label"), multiple: false });
      if (typeof target === "string" && target.trim()) {
        setEngineCustomBinPath(target);
        writeStoredString(ENGINE_CUSTOM_BIN_KEY, target);
      }
    } catch (error) {
      setServiceRestartError(error instanceof Error ? error.message : safeStringify(error));
    }
  }, []);

  const onClearEngineCustomBinPath = useCallback(() => {
    setEngineCustomBinPath("");
    clearStoredString(ENGINE_CUSTOM_BIN_KEY);
  }, []);

  const bootFullEngineStack = useCallback(async () => {
    const workspacePath = optionsRef.current.selectedWorkspaceRoot.trim();
    if (!workspacePath) {
      throw new Error(
        "Select a local workspace before starting the local server/engine.",
      );
    }

    // Collect ALL local workspace paths so openwork-server is started with
    // --workspace <path> for every registered local workspace. Mirrors the
    // Solid reference (context/workspace.ts::resolveWorkspacePaths) so that
    // `client.listWorkspaces()` later returns the full set, not just the
    // active one.
    const workspacePaths = [workspacePath];
    const workspacePathSet = new Set(workspacePaths);
    try {
      const list = (await workspaceBootstrapCmd()) as { workspaces?: Array<{ workspaceType?: string; path?: string }> } | null;
      for (const entry of list?.workspaces ?? []) {
        if (entry.workspaceType === "remote") continue;
        const path = entry.path?.trim() ?? "";
        if (path && !workspacePathSet.has(path)) {
          workspacePaths.push(path);

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Select a local workspace folder in the settings/debug view before booting the engine stack.
  2. If a workspace should already be selected, check that the selection persisted (stored workspace root key) and re-pick it.
  3. Restart the app after selecting the workspace if the view model still reads an empty root.

Example fix

// before
const workspacePath = optionsRef.current.selectedWorkspaceRoot.trim();
if (!workspacePath) {
  throw new Error("Select a local workspace before starting the local server/engine.");
}
// after
const workspacePath = optionsRef.current.selectedWorkspaceRoot.trim();
if (!workspacePath) {
  setSelectedWorkspaceRoot(await promptForWorkspaceFolder()); // pick one up front
  return bootFullEngineStack();
}
Defensive patterns

Strategy: validation

Validate before calling

const workspacePath = optionsRef.current.selectedWorkspaceRoot.trim();
if (!workspacePath) {
  alert("Select a local workspace first.");
  return; // don't call bootFullEngineStack
}

Try / catch

try {
  await bootFullEngineStack();
} catch (err) {
  if (err.message.includes("Select a local workspace")) openWorkspacePicker();
  else showBootError(err);
}

Prevention

When it happens

Trigger: Clicking the debug 'boot full engine stack' action while optionsRef.current.selectedWorkspaceRoot is an empty string (no workspace registered/selected in the debug panel).

Common situations: Fresh install or cleared settings where no workspace was ever selected; user cleared the workspace field; running the desktop app in a state where workspace selection was not persisted; opening the debug view before picking a folder.

Related errors


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