stablyai/orca · error

${RPC error message}

Error message

${RPC error message}

What it means

Thrown by resolveMobileFileTabDoc when the staged/unstaged diff path fails. For diffSource 'staged' or 'unstaged', it calls git.diff with the worktree, filePath, and staged flag; if the host returns {ok:false} the error message is re-thrown. This typically surfaces 'file_too_large', path-not-found, or git errors from the host.

Source

Thrown at mobile/src/files/mobile-file-tab-doc.ts:39

  diffSource?: 'staged' | 'unstaged' | 'branch' | 'commit'
}

// Throws 'binary_file'/'file_too_large'/the RPC error message; callers map those
// to error docs.
export async function resolveMobileFileTabDoc(
  client: FileTabDocClient,
  request: MobileFileTabDocRequest
): Promise<MobileFileTabDoc> {
  const worktree = `id:${request.worktreeId}`
  const { relativePath } = request
  if (request.diffSource === 'staged' || request.diffSource === 'unstaged') {
    const response = await client.sendRequest('git.diff', {
      worktree,
      filePath: relativePath,
      staged: request.diffSource === 'staged'
    })
    if (!response.ok) {
      throw new Error((response as RpcFailure).error.message)
    }
    const result = (response as RpcSuccess).result as
      | { kind: 'text'; originalContent: string; modifiedContent: string }
      | MobileBinaryDiffResult
    if (result.kind !== 'text') {
      // Render image diffs (add/modify/delete) from the base64 the host already
      // sends; only non-previewable binaries stay unavailable.
      const dataUri = mobileDiffImageDataUri(result)
      if (!dataUri) {
        throw new Error('binary_file')
      }
      return { status: 'ready', kind: 'image', dataUri }
    }
    const diff = buildMobileDiffLines(result.originalContent, result.modifiedContent)
    return { status: 'ready', kind: 'diff', lines: diff.lines, truncated: diff.truncated }
  }

  const artifactKind = classifyMobileArtifact(relativePath)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Map known codes: 'file_too_large' and 'binary_file' are produced elsewhere in this file — handle them in the caller as distinct doc states rather than generic errors.
  2. Verify relativePath still exists at the requested diffSource via the file tree before re-opening the tab.
  3. If the worktree was rotated, navigate back to the worktree list and re-open the file.
  4. For host git errors, check the desktop's git capability cache and logs.

Example fix

// before
if (!response.ok) {
  throw new Error((response as RpcFailure).error.message)
}

// after — normalize known codes the caller already maps
if (!response.ok) {
  const code = (response as RpcFailure).error?.code
  if (code === 'file_too_large') throw new Error('file_too_large')
  if (code === 'binary') throw new Error('binary_file')
  throw new Error((response as RpcFailure).error.message)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the file path exists at the requested diffSource before opening
const entries = await client.sendRequest('files.readDir', { worktree, relativePath: dirname(relativePath) })
if (!entries.ok) return

Type guard

function isBinaryFileError(err: unknown): boolean {
  return err instanceof Error && err.message === 'binary_file'
}
function isFileTooLargeError(err: unknown): boolean {
  return err instanceof Error && err.message === 'file_too_large'
}

Try / catch

try {
  return await resolveMobileFileTabDoc(client, request)
} catch (err) {
  if (isBinaryFileError(err)) return { status: 'ready', kind: 'binary' } as any
  if (isFileTooLargeError(err)) return { status: 'ready', kind: 'too_large' } as any
  setErrorDoc(err.message)
}

Prevention

When it happens

Trigger: client.sendRequest('git.diff', {worktree: `id:${worktreeId}`, filePath: relativePath, staged: boolean}) returns {ok:false}. Causes: file does not exist at that revision, file is binary-only with no text diff (host may emit a specific code), git binary on host errored, worktree missing, path is a directory.

Common situations: User opens a diff tab for a file deleted in the working tree; the host's git binary failed on a corrupt index; very large files where the host caps diff size; race where the file was renamed between snapshot and diff request.

Related errors


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