{"record":{"id":"95eec0ec1c7ec265","repo":"stablyai/orca","slug":"created-terminal-response-was-invalid-95eec0","errorCode":null,"errorMessage":"Created terminal response was invalid","messagePattern":"Created terminal response was invalid","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/session/use-mobile-diff-review-send-actions.ts","lineNumber":118,"sourceCode":"  )\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', {\n        worktree: `id:${worktreeId}`\n      })\n      if (!response.ok) {\n        throw new Error(response.error?.message || 'Unable to load agent sessions')","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/session/use-mobile-diff-review-send-actions.ts#L100-L136","documentation":"Same reader/shape as 384 but on the notes-send create path: `session.tabs.createTerminal` returned ok:true but `readMobileReviewCreatedTerminal` returned null (the payload is not a type:'terminal' tab with id + terminal).","triggerScenarios":"Version/codec drift in the create-terminal result schema.","commonSituations":"Client/host version mismatch; host returned a non-terminal tab; malformed serialization.","solutions":["Match client/host versions.","Capture and compare the raw result.","Fall back to a manual terminal.","Report with host version."],"exampleFix":"// before\nif (!created) {\n  throw new Error('Created terminal response was invalid')\n}\n// after\nif (!created) {\n  console.warn('[send-notes] unexpected createTerminal result', response.result)\n  throw new Error('Created terminal response was invalid (host/client version mismatch)')\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function readMobileReviewCreatedTerminal(value: unknown): MobileReviewTerminalTab | null {\n  if (!isRecord(value) || !isRecord(value.tab)) return null\n  return readMobileReviewTerminalTabs({ tabs: [value.tab] })[0] ?? null\n}","tryCatchPattern":"const created = readMobileReviewCreatedTerminal(response.result)\nif (!created) {\n  setActionError('Terminal response unrecognized - update Orca')\n  return\n}","preventionTips":["Keep paired versions compatible.","Unit-test the reader against host fixtures.","Log unrecognized payloads."],"tags":["rpc","terminal","schema","version-mismatch","send-notes","mobile"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}