stablyai/orca · error · Error

Source control action failed

Error message

Source control action failed

What it means

Thrown (then caught locally) when a git mutation RPC - git.stage, git.unstage, etc. (GitMutationMethod) - returns ok:false for a single file. The host's error.message is preferred. The local catch sets actionError and triggers an error haptic; it does NOT propagate.

Source

Thrown at mobile/src/session/use-mobile-diff-review-git-actions.ts:37

export function useMobileDiffReviewGitActions(input: GitActionsInput) {
  const { client, connState, worktreeId, queue, setActionError, setBusyAction, loadReviewData } =
    input

  const runGitMutation = useCallback(
    async (method: GitMutationMethod, item: MobileDiffReviewQueueItem) => {
      if (!client || connState !== 'connected') {
        setActionError('Waiting for desktop...')
        return
      }
      setBusyAction(`${method}:${item.filePath}`)
      setActionError(null)
      try {
        const response = await client.sendRequest(method, {
          worktree: `id:${worktreeId}`,
          filePath: item.filePath
        })
        if (!response.ok) {
          throw new Error(response.error?.message || 'Source control action failed')
        }
        triggerSuccess()
        await loadReviewData()
      } catch (err) {
        triggerError()
        setActionError(err instanceof Error ? err.message : 'Source control action failed')
      } finally {
        setBusyAction(null)
      }
    },
    [client, connState, loadReviewData, setActionError, setBusyAction, worktreeId]
  )

  const stageReviewedFiles = useCallback(async () => {
    if (!client || connState !== 'connected') {
      setActionError('Waiting for desktop...')
      return
    }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Refresh the review data (loadReviewData) to get fresh status.
  2. Check for a stale git lockfile on the host.
  3. Retry the single-file action.
  4. Inspect the host git error in logs.

Example fix

// before
if (!response.ok) {
  throw new Error(response.error?.message || 'Source control action failed')
}
// after
if (!response.ok) {
  throw new RpcMethodError(method, response.error)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!client || connState !== 'connected') {
  setActionError('Waiting for desktop...')
  return
}

Type guard

function isRpcFailure(r: RpcResponse): r is RpcFailure {
  return r.ok === false
}

Try / catch

try {
  await runGitMutation(method, item)
} catch (err) {
  setActionError(err instanceof Error ? err.message : 'Source control action failed')
}

Prevention

When it happens

Trigger: Host git operation fails for the file path - path no longer in the index, git lockfile contention, merge conflict state, or permission. Called from per-file stage/unstage buttons.

Common situations: File changed/disappeared between status fetch and the stage call; .git/index.lock held by another process; file in a conflict the mutation cannot resolve; host git binary error.

Related errors


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