{"record":{"id":"d04626cf49658585","repo":"stablyai/orca","slug":"could-not-refresh-base-ref-basebranch-from-d04626","errorCode":null,"errorMessage":"Could not refresh base ref \"${baseBranch}\" from \"${remoteTrackingRefresh.base.remote}\". Check your network and try again.","messagePattern":"Could not refresh base ref \"(.+?)\" from \"(.+?)\"\\. Check your network and try again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/worktree-remote.ts","lineNumber":2223,"sourceCode":"      )\n    }\n    throw new Error(\n      `Could not find an available worktree name for \"${sanitizedName}\". Pick a different worktree name.`\n    )\n  }\n\n  validateWorkspaceLineageParentBeforeCreate(\n    store,\n    args.parentWorkspace,\n    worktreeWorkspaceKey(`${repo.id}::${worktreePath}`)\n  )\n\n  if (remoteTrackingRefresh) {\n    await timing.time('refresh_base_ref', async () => {\n      const result = await remoteTrackingRefresh.promise\n      if (!result.ok && !remoteTrackingRefresh.hadLocalBaseRef) {\n        // Why: only block create when the refresh failed AND there's no local base ref; an existing (possibly stale) ref keeps worktree add viable.\n        throw new Error(\n          `Could not refresh base ref \"${baseBranch}\" from \"${remoteTrackingRefresh.base.remote}\". Check your network and try again.`\n        )\n      }\n      if (\n        !remoteTrackingRefresh.hadLocalBaseRef &&\n        !(await runtime?.hasRemoteTrackingRef(\n          repo.path,\n          remoteTrackingRefresh.base,\n          ...localWorktreeGitOptionArgs\n        ))\n      ) {\n        throw new Error(`Base ref \"${baseBranch}\" was not found after fetching.`)\n      }\n    })\n  }\n\n  if (legacyFetchPromise) {\n    await timing.time('refresh_base_ref', async () => {","sourceCodeStart":2205,"sourceCodeEnd":2241,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/worktree-remote.ts#L2205-L2241","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restore network and retry — the refresh re-runs each create.","Confirm the base branch exists on the remote (git ls-remote origin).","Choose an explicit baseBranch that is already cached locally.","Re-authenticate the remote if the fetch failed on credentials."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Confirm network + ref presence before create\nconst reachable = await pingRemote(repo.remoteUrl)\nconst hasRef = await runtime.hasRemoteTrackingRef(repo.path, remoteTrackingRefresh.base)\nif (!reachable || (!hasRef && !remoteTrackingRefresh.hadLocalBaseRef)) {\n  return { ok: false, error: 'Cannot reach remote to fetch base ref. Check network and retry.' }\n}","typeGuard":null,"tryCatchPattern":"catch (err) {\n  if (err instanceof Error && err.message.startsWith('Could not refresh base ref')) {\n    await reconnectRemote(repo)\n    return retryCreate()\n  }\n  throw err\n}","preventionTips":["Ensure network/VPN is up before creating.","Cache the base ref locally so a refresh failure has a stale fallback.","Re-authenticate the remote if credentials expired."],"tags":["worktree-create","base-ref","network","local","git-fetch"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}