stablyai/orca · error · Error
Could not refresh base ref "${baseBranch}" from "${remoteTra
Error message
Could not refresh base ref "${baseBranch}" from "${remoteTrackingBase.remote}". Check your network and try again. What it means
Remote create: refreshing the remote-tracking base ref failed AND no usable stale local copy of that ref exists. refreshRemoteTrackingBaseForWorktreeCreate threw, and the follow-up hasRemoteTrackingRefSsh also reported the ref absent. The code blocks create only when BOTH conditions hold — a stale-but-present ref would let git worktree add proceed. The message points at network because the refresh is a fetch.
Source
Thrown at src/main/ipc/worktree-remote.ts:1658
presetDirectories.length === sparseDirectories.length &&
sparseDirectories.every((entry) => presetSet.has(entry))
sparsePresetId = directoriesMatch ? preset.id : undefined
} catch {
// Why: corrupt preset data should not block creation or falsely label the new worktree.
}
}
}
// Why: addWorktree/setup probes run inside the new path; older relays need that root registered before accepting git/fs ops there.
await registerRequiredSshWorktreeCreateRoots(repo.connectionId!, [remotePath])
if (remoteTrackingBase) {
try {
await refreshRemoteTrackingBaseForWorktreeCreate(provider, repo, remoteTrackingBase)
} catch {
// Why: a refresh failure shouldn't block create if a usable (stale) local base ref exists; probe after registerRoot and hard-fail only when none does.
if (!(await hasRemoteTrackingRefSsh(provider, repo.path, remoteTrackingBase.ref))) {
throw new Error(
`Could not refresh base ref "${baseBranch}" from "${remoteTrackingBase.remote}". Check your network and try again.`
)
}
}
} else if (!(await hasRemoteWorktreeBaseRef(provider, repo.path, baseBranch))) {
// Why: non-remote-tracking bases keep the legacy best-effort fetch; verified PR/MR SHA bases already have the object, so a broad fetch is wasted.
try {
await fetchRemoteForWorktreeCreate(provider, repo, 'origin')
} catch {
/* best-effort */
}
}
const localBaseRefRefresh =
settings.refreshLocalBaseRefOnWorktreeCreate && !checkoutExistingBranch && remoteTrackingBase
? await refreshLocalBaseRefForRemoteWorktreeCreate(provider, repo.path, remoteTrackingBase)
: undefined
const localBaseRefUpdateSuggestion =View on GitHub (pinned to 1136503c6a)
Solutions
- Restore network/SSH connectivity to the host and retry (the refresh is retried on each create).
- Confirm the base branch still exists on the remote (git ls-remote).
- Pass an explicit baseBranch that is already cached locally, or pick a different base, so the create can proceed from the stale ref.
- Re-authenticate the SSH connection if the fetch failed with an auth error.
Defensive patterns
Strategy: retry
Validate before calling
// Confirm connectivity + ref presence before create
const reachable = await pingSshHost(connectionId)
const hasRef = await hasRemoteTrackingRefSsh(provider, repo.path, remoteTrackingBase.ref)
if (!reachable || !hasRef) {
return { ok: false, error: 'Base ref unavailable and host unreachable. Check network and retry.' }
} Try / catch
catch (err) {
if (err instanceof Error && err.message.startsWith('Could not refresh base ref')) {
// transient network: retry once after reconnect
await reconnectSsh(connectionId)
return retryCreate()
}
throw err
} Prevention
- Keep the SSH connection healthy; reconnect before a create if it's been idle.
- Prefetch and cache the base ref so a refresh failure can fall back to the local copy.
- Confirm the base branch still exists on the remote before creating.
When it happens
Trigger: Remote create with a remoteTrackingBase; the fetch/refresh threw (network down, SSH unreachable, auth failure) and hasRemoteTrackingRefSsh(provider, repo.path, remoteTrackingBase.ref) returned false. Reached at worktree-remote.ts:1658.
Common situations: VPN/network outage to the SSH host; SSH key revoked or agent not forwarded; remote deleted the branch since last clone (so no stale ref either); relay connection dropped mid-fetch; first-ever create on a host with no local refs cached.
Related errors
- Could not refresh base ref "${baseBranch}" from "${remoteTra
- Could not resolve a default base ref for this repo. Pick a b
- Base ref "${baseBranch}" was not found after fetching.
- SSH target did not connect: ${state.status}
- Remote connection dropped. Click Reconnect on the SSH target
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/8fab735e0190215e.
Report an issue: GitHub.