stablyai/orca · error · Error

Could not refresh base ref "${baseBranch}" from "${remoteTra

Error message

Could not refresh base ref "${baseBranch}" from "${remoteTrackingRefresh.base.remote}". Check your network and try again.

What it means

Local worktree create: the remote-tracking base refresh failed AND there was no pre-existing local copy of the ref (remoteTrackingRefresh.hadLocalBaseRef is false). The refresh promise resolved with ok=false. As with the remote variant, a present (possibly stale) local ref would let create proceed; the throw fires only when both the refresh failed and nothing local exists to fall back on.

Source

Thrown at src/main/ipc/worktree-remote.ts:2223

      )
    }
    throw new Error(
      `Could not find an available worktree name for "${sanitizedName}". Pick a different worktree name.`
    )
  }

  validateWorkspaceLineageParentBeforeCreate(
    store,
    args.parentWorkspace,
    worktreeWorkspaceKey(`${repo.id}::${worktreePath}`)
  )

  if (remoteTrackingRefresh) {
    await timing.time('refresh_base_ref', async () => {
      const result = await remoteTrackingRefresh.promise
      if (!result.ok && !remoteTrackingRefresh.hadLocalBaseRef) {
        // Why: only block create when the refresh failed AND there's no local base ref; an existing (possibly stale) ref keeps worktree add viable.
        throw new Error(
          `Could not refresh base ref "${baseBranch}" from "${remoteTrackingRefresh.base.remote}". Check your network and try again.`
        )
      }
      if (
        !remoteTrackingRefresh.hadLocalBaseRef &&
        !(await runtime?.hasRemoteTrackingRef(
          repo.path,
          remoteTrackingRefresh.base,
          ...localWorktreeGitOptionArgs
        ))
      ) {
        throw new Error(`Base ref "${baseBranch}" was not found after fetching.`)
      }
    })
  }

  if (legacyFetchPromise) {
    await timing.time('refresh_base_ref', async () => {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Restore network and retry — the refresh re-runs each create.
  2. Confirm the base branch exists on the remote (git ls-remote origin).
  3. Choose an explicit baseBranch that is already cached locally.
  4. Re-authenticate the remote if the fetch failed on credentials.
Defensive patterns

Strategy: retry

Validate before calling

// Confirm network + ref presence before create
const reachable = await pingRemote(repo.remoteUrl)
const hasRef = await runtime.hasRemoteTrackingRef(repo.path, remoteTrackingRefresh.base)
if (!reachable || (!hasRef && !remoteTrackingRefresh.hadLocalBaseRef)) {
  return { ok: false, error: 'Cannot reach remote to fetch base ref. Check network and retry.' }
}

Try / catch

catch (err) {
  if (err instanceof Error && err.message.startsWith('Could not refresh base ref')) {
    await reconnectRemote(repo)
    return retryCreate()
  }
  throw err
}

Prevention

When it happens

Trigger: Local create with remoteTrackingRefresh set; the awaited refresh result has ok=false and hadLocalBaseRef is false. Reached at worktree-remote.ts:2223 inside the 'refresh_base_ref' timing block.

Common situations: Network/VPN outage during fetch; auth credential expired; remote branch deleted since last clone with no local cache; first create on a fresh clone with the default ref never fetched; proxy/firewall blocking the fetch.

Related errors


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