{"record":{"id":"58afcd22c0a396b4","repo":"stablyai/orca","slug":"base-ref-basebranch-was-not-found-after-fetch","errorCode":null,"errorMessage":"Base ref \"${baseBranch}\" was not found after fetching.","messagePattern":"Base ref \"(.+?)\" was not found after fetching\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/worktree-remote.ts","lineNumber":2235,"sourceCode":"\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 () => {\n      await legacyFetchPromise\n    })\n  }\n  emitCreateWorktreeProgress(mainWindow, 'creating', args.creationId)\n\n  let preparedPushTarget: GitPushTarget | undefined\n  if (args.pushTarget) {\n    // Why: validate/fetch the contributor remote before create so a failure doesn't leave a half-created worktree with conflicts on retry.\n    preparedPushTarget = await prepareWorktreePushTarget(\n      repo.path,\n      args.pushTarget,\n      store,","sourceCodeStart":2217,"sourceCodeEnd":2253,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/worktree-remote.ts#L2217-L2253","documentation":"Local worktree create: the base ref was NOT present locally before the refresh (hadLocalBaseRef false), the refresh completed, but a follow-up runtime.hasRemoteTrackingRef still reports the ref is absent. This means the fetch succeeded (didn't throw) but the requested base ref genuinely does not exist on the remote — wrong branch name, deleted upstream, or typo. Distinct from 1335, which fires when the fetch itself fails.","triggerScenarios":"Local create where hadLocalBaseRef is false, remoteTrackingRefresh.promise resolved ok (or ok=false but not blocking), yet runtime.hasRemoteTrackingRef(repo.path, base, ...) returns false. Reached at worktree-remote.ts:2235.","commonSituations":"User typed a base branch name that doesn't exist on origin; upstream branch was renamed/deleted; fetch pulled other refs but not this one due to refspec config; case mismatch in branch name; shallow clone with narrow refspec.","solutions":["Verify the base branch name against git ls-remote --heads origin and correct it.","Update the repo's remote refspec (git remote set-branches) so the ref is fetched.","Pick a base branch that is known to exist on the remote."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the base branch actually exists on the remote before create\nconst refs = await listRemoteHeads(repo, 'origin')\nif (!refs.includes(baseBranch)) {\n  return { ok: false, fieldError: 'baseBranch', message: `Base branch \"${baseBranch}\" does not exist on origin.` }\n}","typeGuard":null,"tryCatchPattern":"catch (err) {\n  if (err instanceof Error && /was not found after fetching/.test(err.message)) {\n    openBaseBranchPicker(repo, { reason: 'ref-missing' })\n  } else { throw err }\n}","preventionTips":["Confirm the base branch name against git ls-remote --heads origin.","Update remote refspecs (git remote set-branches) for narrow clones.","Pick a base branch known to exist on the remote."],"tags":["worktree-create","base-ref","git-fetch","local","missing-ref"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}