stablyai/orca · error · Error

Created terminal response was invalid

Error message

Created terminal response was invalid

What it means

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).

Source

Thrown at mobile/src/session/use-mobile-diff-review-send-actions.ts:118

  )

  const createTerminalAndSend = useCallback(
    async (comments: readonly DiffComment[]) => {
      if (!client || connState !== 'connected') {
        throw new Error('Waiting for desktop...')
      }
      const response = await client.sendRequest('session.tabs.createTerminal', {
        worktree: `id:${worktreeId}`,
        activate: false,
        select: true,
        navigation: 'caller'
      })
      if (!response.ok) {
        throw new Error(response.error?.message || 'Failed to create terminal')
      }
      const created = readMobileReviewCreatedTerminal(response.result)
      if (!created) {
        throw new Error('Created terminal response was invalid')
      }
      await sendPromptToTerminal(created.terminal, comments)
    },
    [client, connState, sendPromptToTerminal, worktreeId]
  )

  const openSendSheet = useCallback(async () => {
    if (!client || connState !== 'connected') {
      setActionError('Waiting for desktop...')
      return
    }
    setSendSheet({ kind: 'loading' })
    try {
      const response = await client.sendRequest('session.tabs.list', {
        worktree: `id:${worktreeId}`
      })
      if (!response.ok) {
        throw new Error(response.error?.message || 'Unable to load agent sessions')

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Match client/host versions.
  2. Capture and compare the raw result.
  3. Fall back to a manual terminal.
  4. Report with host version.

Example fix

// before
if (!created) {
  throw new Error('Created terminal response was invalid')
}
// after
if (!created) {
  console.warn('[send-notes] unexpected createTerminal result', response.result)
  throw new Error('Created terminal response was invalid (host/client version mismatch)')
}
Defensive patterns

Strategy: type-guard

Type guard

function readMobileReviewCreatedTerminal(value: unknown): MobileReviewTerminalTab | null {
  if (!isRecord(value) || !isRecord(value.tab)) return null
  return readMobileReviewTerminalTabs({ tabs: [value.tab] })[0] ?? null
}

Try / catch

const created = readMobileReviewCreatedTerminal(response.result)
if (!created) {
  setActionError('Terminal response unrecognized - update Orca')
  return
}

Prevention

When it happens

Trigger: Version/codec drift in the create-terminal result schema.

Common situations: Client/host version mismatch; host returned a non-terminal tab; malformed serialization.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/95eec0ec1c7ec265. Report an issue: GitHub.