stablyai/orca · error · Error
Unable to resolve branch base
Error message
Unable to resolve branch base
What it means
Thrown by `resolveMobileBranchCompareBaseRef` on its third and final fallback. The function first tries `worktree.show` and `repo.list` (both `.catch(() => null)` tolerant); if neither carries a base ref it calls `repo.baseRefDefault`. When that RPC fails with a code that is NOT a mobile-git-unavailable signal (`forbidden`, `method_not_found`, or the 'not available to mobile clients' message), the error is surfaced. Git-unavailable failures degrade to null instead.
Source
Thrown at mobile/src/source-control/mobile-branch-base-ref.ts:89
if (worktreeBaseRef) {
return worktreeBaseRef
}
}
if (repoResponse?.ok) {
const repo = readRepoSummaries(repoResponse.result).find((candidate) => candidate.id === repoId)
const repoBaseRef = repo?.worktreeBaseRef?.trim() || null
if (repoBaseRef) {
return repoBaseRef
}
}
const defaultResponse = await client.sendRequest('repo.baseRefDefault', { repo: `id:${repoId}` })
if (!defaultResponse.ok) {
if (isMobileGitUnavailable(defaultResponse.error?.code, defaultResponse.error?.message)) {
return null
}
throw new Error(defaultResponse.error?.message || 'Unable to resolve branch base')
}
return readDefaultBaseRef(defaultResponse.result)
}
View on GitHub (pinned to 1136503c6a)
Solutions
- Verify the repo actually has a default/base branch configured on the host (check repo settings or `git symbolic-ref refs/remotes/origin/HEAD`).
- Confirm the `repoId` segment of the mobile worktree id still matches a live repo via `repo.list`.
- Update the desktop host so `repo.baseRefDefault` is implemented or returns a stable git-unavailable code for old builds.
- If the error is transient (host restarting), reconnect and retry the branch-compare load.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check that at least one source can supply a base ref before depending on it.
const hasAnyBaseRefSource =
(await client.sendRequest('worktree.show', { worktree: `id:${worktreeId}` }).catch(() => null))?.ok ||
(await client.sendRequest('repo.list').catch(() => null))?.ok
if (!hasAnyBaseRefSource) { /* expect possible throw from baseRefDefault */ } Try / catch
let baseRef: string | null
try {
baseRef = await resolveMobileBranchCompareBaseRef(client, worktreeId)
} catch (err) {
// degrade gracefully — disable compare/rebase rather than crashing the screen
baseRef = null
reportNonFatal(err)
}
if (!baseRef) { setBranchCompareState({ kind: 'idle' }) } Prevention
- Treat a null result and a throw differently: null = git-unavailable/degraded, throw = real RPC error.
- Configure a default base branch on repos so the final fallback resolves.
- Keep `worktree.show`/`repo.list` tolerant (they already `.catch(() => null)`).
When it happens
Trigger: Both `worktree.show` and `repo.list` returned no `worktreeBaseRef`/`baseRef`, AND `repo.baseRefDefault` returns ok:false with a non-transient, non-git-unavailable error code (e.g. `repo_not_found`, `invalid_params`, `internal_error`).
Common situations: The repo has no configured default base branch and the host rejects `baseRefDefault`; the `repoId` parsed from the worktree id is stale after a repo rename/move; the host's repo metadata is partially loaded on first pairing; mixed client/host versions where `repo.baseRefDefault` is not yet implemented returns an unexpected code.
Related errors
- Source control action failed
- Failed to load commit history
- ${created.current.error}
- No base branch to rebase onto
- Unable to load committed changes
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/80d66cc8ecc5f506.
Report an issue: GitHub.