stablyai/orca · warning · Error

Branch status unavailable

Error message

Branch status unavailable

What it means

Thrown in the fallback branch of `readUpstreamStatusForSync`. When `git.upstreamStatus` fails with a mobile-git-unavailable code, the code degrades to `git.status` and reads `status.upstreamStatus`. If that field is absent (the branch has no upstream tracking configured), the sync cannot compute ahead/behind and this error is thrown. Non-git-unavailable failures re-throw the original error instead.

Source

Thrown at mobile/src/source-control/use-mobile-git-requests.ts:63

        throw new Error(result?.error || 'Commit failed')
      }
      return result
    },
    [sendGitRequest]
  )

  const readUpstreamStatusForSync = useCallback(async (): Promise<MobileGitUpstreamStatus> => {
    try {
      return await sendGitRequest<MobileGitUpstreamStatus>('git.upstreamStatus')
    } catch (err) {
      const code = err instanceof Error ? (err as GitRequestError).code : undefined
      const message = err instanceof Error ? err.message : String(err)
      if (!isMobileGitUnavailable(code, message)) {
        throw err
      }
      const status = await sendGitRequest<MobileGitStatusResult>('git.status')
      if (!status.upstreamStatus) {
        throw new Error('Branch status unavailable')
      }
      return status.upstreamStatus
    }
  }, [sendGitRequest])

  const runGitSyncSteps = useCallback(async () => {
    await sendGitRequest<unknown>('git.fetch')
    await sendGitRequest<unknown>('git.pull')
    const nextUpstream = await readUpstreamStatusForSync()
    if (nextUpstream.ahead > 0) {
      await sendGitRequest<unknown>('git.push')
    }
  }, [readUpstreamStatusForSync, sendGitRequest])

  return { sendGitRequest, sendCommitRequest, runGitSyncSteps }
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Push the branch with upstream tracking first (`git push -u origin <branch>`).
  2. Update the desktop host so `git.upstreamStatus` is supported natively.
  3. If the branch is intentionally local, skip sync until an upstream is configured.
Defensive patterns

Strategy: fallback

Validate before calling

// Check upstream tracking before offering Sync.
if (!status.branch?.upstream) {
  setSyncUnavailable('Set an upstream branch before syncing.')
}

Try / catch

// readUpstreamStatusForSync already degrades git.upstreamStatus → git.status;
// treat 'Branch status unavailable' as 'no upstream' and skip push.
try {
  const upstream = await readUpstreamStatusForSync()
} catch (err) {
  if (err instanceof Error && err.message === 'Branch status unavailable') {
    // skip push; the branch is local-only
  } else throw err
}

Prevention

When it happens

Trigger: Running `runGitSyncSteps` where `git.upstreamStatus` is unavailable on the host AND the fallback `git.status` returns a result with `upstreamStatus` missing/null — i.e. the current branch has no upstream (local-only branch, never pushed with `-u`).

Common situations: User creates a local branch and tries to Sync before setting an upstream; the upstream remote was deleted; HEAD is detached; the host build is old (no `git.upstreamStatus`) and the branch is untracked.

Related errors


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