{"record":{"id":"c4b188ee79a5e0d9","repo":"stablyai/orca","slug":"automation-workspace-was-created-but-no-agent-ter","errorCode":null,"errorMessage":"Automation workspace was created, but no agent terminal started.","messagePattern":"Automation workspace was created, but no agent terminal started\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/index.ts","lineNumber":2589,"sourceCode":"          let workspaceId: string\n          let workspaceDisplayName: string | null = null\n\n          if (automation.workspaceMode === 'new_per_run') {\n            const created = await runtimeService.createManagedWorktree({\n              ...buildHeadlessAutomationWorktreeCreateArgs({\n                automation,\n                run,\n                repo: target.repo\n              })\n            })\n            terminalHandle = created.startupTerminal?.handle ?? ''\n            terminalSessionId = created.startupTerminal?.tabId ?? null\n            terminalPaneKey = created.startupTerminal?.paneKey ?? null\n            terminalPtyId = created.startupTerminal?.ptyId ?? null\n            workspaceId = created.worktree.id\n            workspaceDisplayName = created.worktree.displayName ?? null\n            if (!terminalHandle) {\n              throw new Error(\n                created.warning ||\n                  'Automation workspace was created, but no agent terminal started.'\n              )\n            }\n          } else {\n            if (!automation.workspaceId) {\n              throw new Error('The target workspace is no longer available.')\n            }\n            const terminal = await runtimeService.launchAgentTerminal(\n              `id:${automation.workspaceId}`,\n              {\n                agent: automation.agentId,\n                prompt: automation.prompt,\n                title: run.title\n              }\n            )\n            terminalHandle = terminal.handle\n            terminalSessionId = terminal.tabId ?? null","sourceCodeStart":2571,"sourceCodeEnd":2607,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/index.ts#L2571-L2607","documentation":"Thrown during automation-run startup when the workspace/worktree was created successfully but the returned startupTerminal has no handle (empty string) and the creator supplied no warning text. This is the fallback message indicating the agent terminal failed to start even though the workspace exists — a partial-success state that the caller cannot safely proceed from.","triggerScenarios":"createAutomationWorkspace (or equivalent) returns a created worktree but startupTerminal.handle is empty/null and created.warning is empty. Happens when the terminal subsystem (PTY) failed to spawn silently, the tab/pane creation returned an empty handle, or an internal error path neglected to populate the warning.","commonSituations":"PTY allocation failure on the host; terminal service not initialized at automation start; race where the workspace was created but the terminal manager was torn down; a bug in the workspace creator returning an incomplete terminal descriptor.","solutions":["Retry the automation run after confirming the terminal/PTY subsystem is healthy.","Check the runtime logs for PTY spawn errors or terminal-service initialization failures.","Ensure the host has sufficient resources (PTY slots, file descriptors) before launching automation.","Report created.warning to the operator UI — if empty, file a bug since the creator should explain why no terminal started."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function hasTerminalHandle(created: unknown): created is { startupTerminal: { handle: string } } {\n  return typeof created === 'object' && created !== null\n    && typeof (created as any).startupTerminal?.handle === 'string'\n    && (created as any).startupTerminal.handle.length > 0\n}","tryCatchPattern":"try {\n  await startAutomationRun(...)\n} catch (error) {\n  if (/no agent terminal started/.test(String((error as Error).message))) {\n    await retryAfterHealthCheck() // verify PTY/terminal service, then retry\n  } else throw error\n}","preventionTips":["Ensure the terminal/PTY subsystem is initialized before starting automation runs.","Surface created.warning in operator UI even when present, so silent failures are visible.","Monitor PTY allocation metrics and fail fast when slots are exhausted."],"tags":["automation","terminal","workspace","pty","startup"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}