{"record":{"id":"3fefc2a41796481b","repo":"stablyai/orca","slug":"failed-to-create-terminal-3fefc2","errorCode":null,"errorMessage":"Failed to create terminal","messagePattern":"Failed to create terminal","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/session/use-mobile-diff-review-send-actions.ts","lineNumber":114,"sourceCode":"      setActionError('Review notes sent')\n      setSendSheet(null)\n    },\n    [client, connState, markNotesSent, setActionError, setSendSheet]\n  )\n\n  const createTerminalAndSend = useCallback(\n    async (comments: readonly DiffComment[]) => {\n      if (!client || connState !== 'connected') {\n        throw new Error('Waiting for desktop...')\n      }\n      const response = await client.sendRequest('session.tabs.createTerminal', {\n        worktree: `id:${worktreeId}`,\n        activate: false,\n        select: true,\n        navigation: 'caller'\n      })\n      if (!response.ok) {\n        throw new Error(response.error?.message || 'Failed to create terminal')\n      }\n      const created = readMobileReviewCreatedTerminal(response.result)\n      if (!created) {\n        throw new Error('Created terminal response was invalid')\n      }\n      await sendPromptToTerminal(created.terminal, comments)\n    },\n    [client, connState, sendPromptToTerminal, worktreeId]\n  )\n\n  const openSendSheet = useCallback(async () => {\n    if (!client || connState !== 'connected') {\n      setActionError('Waiting for desktop...')\n      return\n    }\n    setSendSheet({ kind: 'loading' })\n    try {\n      const response = await client.sendRequest('session.tabs.list', {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/session/use-mobile-diff-review-send-actions.ts#L96-L132","documentation":"Thrown when `session.tabs.createTerminal` (for the notes-send path) returns ok:false. The host's error.message is preferred; the literal is the fallback.","triggerScenarios":"Host refuses terminal creation - worktree gone, quota, or a transport failure on the one-shot.","commonSituations":"Worktree deleted mid-review; terminal limit; relay cutover; version skew.","solutions":["Retry after reconnecting.","Verify the worktree exists.","Check host terminal quota.","Update versions."],"exampleFix":"// before\nif (!response.ok) {\n  throw new Error(response.error?.message || 'Failed to create terminal')\n}\n// after\nif (!response.ok) {\n  throw new RpcMethodError('session.tabs.createTerminal', response.error)\n}","handlingStrategy":"try-catch","validationCode":"if (!client || connState !== 'connected') {\n  throw new Error('Waiting for desktop...')\n}","typeGuard":"function isRpcFailure(r: RpcResponse): r is RpcFailure {\n  return r.ok === false\n}","tryCatchPattern":"try {\n  await createTerminalAndSend(comments)\n} catch (err) {\n  setActionError(err instanceof Error ? err.message : 'Failed to create terminal')\n}","preventionTips":["Refresh worktree existence before sending.","Retry once on cutover.","Surface host error message."],"tags":["rpc","terminal","create-terminal","send-notes","mobile"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}