stablyai/orca · error
The target workspace is no longer available.
Error message
The target workspace is no longer available.
What it means
Thrown when an automation run targets an existing workspace (the else-branch) but automation.workspaceId is falsy — the workspace reference is gone, so launchAgentTerminal cannot be called with `id:<workspaceId>`. The workspace was deleted or its ID was never persisted/cleared between sessions.
Source
Thrown at src/main/index.ts:2596
run,
repo: target.repo
})
})
terminalHandle = created.startupTerminal?.handle ?? ''
terminalSessionId = created.startupTerminal?.tabId ?? null
terminalPaneKey = created.startupTerminal?.paneKey ?? null
terminalPtyId = created.startupTerminal?.ptyId ?? null
workspaceId = created.worktree.id
workspaceDisplayName = created.worktree.displayName ?? null
if (!terminalHandle) {
throw new Error(
created.warning ||
'Automation workspace was created, but no agent terminal started.'
)
}
} else {
if (!automation.workspaceId) {
throw new Error('The target workspace is no longer available.')
}
const terminal = await runtimeService.launchAgentTerminal(
`id:${automation.workspaceId}`,
{
agent: automation.agentId,
prompt: automation.prompt,
title: run.title
}
)
terminalHandle = terminal.handle
terminalSessionId = terminal.tabId ?? null
terminalPaneKey = terminal.paneKey ?? null
terminalPtyId = terminal.ptyId ?? null
workspaceId = terminal.worktreeId
const worktree = await runtimeService.showManagedWorktree(`id:${workspaceId}`)
workspaceDisplayName = worktree.displayName ?? null
}
View on GitHub (pinned to 1136503c6a)
Solutions
- Create a fresh workspace for the automation (re-trigger workspace creation rather than reusing).
- If the worktree still exists on disk, re-register it to obtain a workspaceId.
- Prevent the race: ensure automation.workspaceId is persisted atomically with workspace creation.
Defensive patterns
Strategy: validation
Validate before calling
function hasWorkspaceId(automation: { workspaceId?: string | null }): boolean {
return typeof automation.workspaceId === 'string' && automation.workspaceId.length > 0
} Type guard
function hasValidWorkspaceId(a: unknown): a is { workspaceId: string } {
return typeof a === 'object' && a !== null && typeof (a as any).workspaceId === 'string' && (a as any).workspaceId.length > 0
} Try / catch
if (!automation.workspaceId) {
// create a fresh workspace instead of failing
await recreateAutomationWorkspace(automation.id)
} else {
await launchTerminal(automation)
} Prevention
- Persist automation.workspaceId atomically with workspace creation.
- Before reuse, verify the workspace still exists via the runtime service.
- Handle out-of-band workspace deletion by clearing workspaceId and forcing recreation.
When it happens
Trigger: Resuming or re-launching an automation run whose workspaceId is null/undefined/empty. Occurs when the worktree was deleted out-of-band, the automation record was partially reset, or the workspace registration failed to persist the ID.
Common situations: User deleted the worktree directory manually; a cleanup/GC pass removed the workspace; the automation was migrated between machines and lost its workspace reference; a crash left the automation record half-written.
Related errors
- Automation not found.
- Automation run not found.
- Automation workspace was created, but no agent terminal star
- relay pairing client closed
- mobile pairing cancelled
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/332e24fb5194079e.
Report an issue: GitHub.