different-ai/openwork · error · Error
No local workspace is available
Error message
No local workspace is available
What it means
resolveAssignmentWorkspace picks the active workspace (or first item) from the local runtime's workspace list to run a Desktop Automation assignment. If the pinned/execution runtime is fine but the list has no workspace with a usable id, there is no local workspace to execute in, so it throws with code path 'no local workspace'.
Source
Thrown at apps/desktop/electron/automation-runner.mjs:145
*
* A pinned workspace must exist locally: running the Automation in whatever
* workspace happens to be active would silently retarget it, which is the
* exact bug pinning exists to prevent. Unpinned (legacy) assignments keep the
* historical active-workspace fallback.
*/
export function resolveAssignmentWorkspace(listed, pinnedWorkspaceId) {
const workspaces = Array.isArray(listed?.items) ? listed.items : []
if (pinnedWorkspaceId) {
const pinned = workspaces.find((item) => item?.id === pinnedWorkspaceId)
if (!pinned?.id) {
const error = new Error(`The Automation's pinned workspace is not available on this desktop`)
Object.defineProperty(error, "code", { value: "execution_runtime_unavailable" })
throw error
}
return pinned
}
const workspace = workspaces.find((item) => item?.id === listed?.activeId) ?? workspaces[0]
if (!workspace?.id) throw new Error("No local workspace is available")
return workspace
}
/** Runs the assignment as a normal visible local OpenWork thread. */
export async function executeDesktopAutomation(assignment, options) {
const local = await options.getLocalRuntime()
if (!local?.baseUrl || !local?.token) throw new Error("The desktop runtime is unavailable")
const localRequest = (requestPath, request = {}) => requestJson(
options.fetchImpl ?? fetch,
local.baseUrl,
local.token,
requestPath,
{ ...request, signal: options.signal },
)
const listed = await localRequest("/workspaces")
const workspace = resolveAssignmentWorkspace(listed, assignment.workspaceId ?? null)
const workspaceId = String(workspace.id)
const client = createWorkspaceSessionClient(local, workspaceId, options.fetchImpl ?? fetch)View on GitHub (pinned to 2b7df46e8a)
Solutions
- Create at least one local workspace in the OpenWork app before scheduling automation
- Re-run onboarding/workspace creation so the server has a workspace
- Check /workspaces response to confirm items exist with ids
- Restore or reset corrupted workspace state
Example fix
// before: scheduling automation on a machine with zero workspaces
await scheduleAssignment(assignment); // -> No local workspace is available
// after: ensure a workspace exists first
const listed = await requestJson(fetch, baseUrl, token, "/workspaces");
if (!listed?.items?.length) await createWorkspace({ name: "Default" });
await scheduleAssignment(assignment); Defensive patterns
Strategy: validation
Validate before calling
const listed = await requestJson(fetch, baseUrl, token, "/workspaces");
const items = Array.isArray(listed?.items) ? listed.items : [];
if (!items.some(w => typeof w?.id === "string" && w.id)) {
throw new Error("Create a local workspace before running automation");
} Type guard
function hasUsableWorkspace(listed) {
const items = Array.isArray(listed?.items) ? listed.items : [];
return items.some(w => typeof w?.id === "string" && w.id.length > 0);
} Try / catch
try {
await runAssignment(assignment);
} catch (err) {
if (err.message === "No local workspace is available") {
await createDefaultWorkspace();
await runAssignment(assignment);
} else throw err;
} Prevention
- Provision a default workspace during first-run onboarding
- Never allow scheduling automations while zero workspaces exist
- Validate /workspaces output shape before executing assignments
- Alert the user when workspace count drops to zero
When it happens
Trigger: executeDesktopAutomation calls resolveAssignmentWorkspace; the /workspaces listing returns an empty array or items all lack `id`, and the fallback `workspaces[0]` is undefined/no-id.
Common situations: Fresh install where no workspace was ever created; all workspaces deleted; automation scheduled before first-run onboarding completed; corrupted workspace state file.
Related errors
- OpenWork server cannot read MCP config for this workspace.
- Cannot create a task without a selected workspace.
- Workspace path is unavailable; attachments could not be copi
- Workspace endpoint is unavailable; attachments could not be
- Select a local workspace before starting the local server/en
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/25337bc03fe936b0.
Report an issue: GitHub.