{"record":{"id":"df53075a8ad6de5d","repo":"stablyai/orca","slug":"repo-has-no-configured-origin-remote","errorCode":null,"errorMessage":"Repo has no configured origin remote.","messagePattern":"Repo has no configured origin remote\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/github/review-head-remote.ts","lineNumber":26,"sourceCode":"// Why: explicit origin must match issue listing; otherwise hosting identity\n// keeps contributor clones on the upstream project's PR namespace.\nexport async function resolveGitHubReviewHeadRemote(args: {\n  repoPath: string\n  issueSourcePreference?: IssueSourcePreference\n  connectionId?: string | null\n  localGitOptions?: { wslDistro?: string }\n  gitExec: GitExec\n}): Promise<string> {\n  const { stdout } = await args.gitExec(['remote'])\n  const remotes = stdout\n    .split(/\\r?\\n/)\n    .map((line) => line.trim())\n    .filter(Boolean)\n  if (args.issueSourcePreference === 'origin') {\n    if (remotes.includes('origin')) {\n      return 'origin'\n    }\n    throw new Error('Repo has no configured origin remote.')\n  }\n  // Why: identity probes cost a `remote get-url` (plus a possible gh auth\n  // lookup) each; only multi-remote clones are ambiguous enough to need them.\n  if (remotes.length > 1) {\n    for (const remote of ['upstream', 'origin']) {\n      if (!remotes.includes(remote)) {\n        continue\n      }\n      const repository = await getGitHubApiRepositoryForRemote(\n        args.repoPath,\n        remote,\n        args.connectionId ?? null,\n        args.localGitOptions ?? {}\n      )\n      if (repository) {\n        return remote\n      }\n    }","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/github/review-head-remote.ts#L8-L44","documentation":"Thrown by resolveGitHubReviewHeadRemote when the caller requests issueSourcePreference 'origin' (so PR/review heads must come from the GitHub project hosted under the 'origin' remote) but `git remote` output contains no entry named 'origin'. The function deliberately hard-fails rather than guessing another remote, because listing issues/PRs against the wrong namespace would silently attribute a contributor's work to the upstream project.","triggerScenarios":"Calling resolveGitHubReviewHeadRemote with issueSourcePreference === 'origin' on a clone whose only remote is 'upstream', a personally-named remote, or where `git remote` returns empty. Also hit when a fork-only clone (no origin added after `git clone <upstream>`) is configured to prefer origin.","commonSituations":"Fork-and-upstream workflows where the user cloned the upstream repo and added their fork under a custom name; CI checkouts that drop the origin remote; repos migrated/imported where the default remote was renamed; setting issueSourcePreference='origin' globally then opening a repo that lacks origin.","solutions":["Add an origin remote pointing at your GitHub fork: `git remote add origin https://github.com/<you>/<repo>.git`","If your fork lives under a different remote name, either rename it to origin (`git remote rename <name> origin`) or change issueSourcePreference away from 'origin' so the resolver can probe upstream/origin by GitHub identity.","Run `git remote -v` to confirm which remotes exist and that origin is spelled exactly 'origin'."],"exampleFix":"// before\nresolveGitHubReviewHeadRemote({ repoPath, issueSourcePreference: 'origin', gitExec })\n// after — verify origin exists, or fall back to auto-resolution\nconst remotes = (await gitExec(['remote'])).stdout.split(/\\r?\\n/).filter(Boolean)\nresolveGitHubReviewHeadRemote({\n  repoPath,\n  issueSourcePreference: remotes.includes('origin') ? 'origin' : 'auto',\n  gitExec\n})","handlingStrategy":"validation","validationCode":"const remotes = (await gitExec(['remote'])).stdout.split(/\\r?\\n/).map(l => l.trim()).filter(Boolean)\nif (issueSourcePreference === 'origin' && !remotes.includes('origin')) {\n  throw new Error(`Cannot use origin preference: remotes are [${remotes.join(', ')}]`)\n}","typeGuard":"function hasOriginRemote(remotes: string[]): boolean {\n  return remotes.includes('origin')\n}","tryCatchPattern":"try {\n  return await resolveGitHubReviewHeadRemote({ repoPath, issueSourcePreference, gitExec })\n} catch (error) {\n  if (error instanceof Error && error.message === 'Repo has no configured origin remote.') {\n    // fall back to auto-resolution or prompt user to add origin\n    return await resolveGitHubReviewHeadRemote({ repoPath, issueSourcePreference: 'auto', gitExec })\n  }\n  throw error\n}","preventionTips":["Standardize fork clones so the fork is always 'origin' and upstream is 'upstream'.","Validate required remotes exist before binding issueSourcePreference='origin' to a repo.","Surface a preflight check in repo-add flow that warns when origin is missing."],"tags":["git","github","remote","configuration"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}