stablyai/orca · error

Repo has multiple remotes (${remotes.join(', ')}) and no def

Error message

Repo has multiple remotes (${remotes.join(', ')}) and no default is configured. Set branch.<default>.remote.

What it means

getDefaultRemote throws when the repo has more than one remote, none of them is 'origin', no branch.<default>.remote config is set for the current default branch, and there is therefore no unambiguous choice. The message lists the remotes and tells the user to set branch.<default>.remote. Like 1052, it is rethrown verbatim by the surrounding catch.

Source

Thrown at src/main/git/repo.ts:851

    }
  }

  try {
    const { stdout } = await gitExecFileAsync(['remote'], gitExecOptions(path, options))
    const remotes = stdout
      .split('\n')
      .map((line) => line.trim())
      .filter(Boolean)
    if (remotes.includes('origin')) {
      return 'origin'
    }
    if (remotes.length === 1) {
      return remotes[0]
    }
    if (remotes.length === 0) {
      throw new Error('Repo has no configured git remotes.')
    }
    throw new Error(
      `Repo has multiple remotes (${remotes.join(', ')}) and no default is configured. Set branch.<default>.remote.`
    )
  } catch (error) {
    if (error instanceof Error) {
      throw error
    }
    throw new Error('Failed to resolve default remote for repo.')
  }
}

export async function searchBaseRefs(path: string, query: string, limit = 25): Promise<string[]> {
  return (await searchBaseRefDetails(path, query, limit)).map((entry) => entry.refName)
}

export async function searchBaseRefDetails(
  path: string,
  query: string,
  limit = 25

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set the default remote for the branch: git config branch.<defaultBranch>.remote <remote> (and branch.<defaultBranch>.merge if you also want a merge ref).
  2. Rename one of the remotes to 'origin' if that is the intended default: git remote rename <current> origin.
  3. Remove remotes you no longer need so only one candidate remains.
  4. Pass an explicit remote/pushTarget to the calling operation instead of relying on default resolution.

Example fix

// before
// repo has remotes: upstream, fork — no default
const remote = await getDefaultRemote(repoPath)

// after: pin the default branch's remote
await run('git', ['config', `branch.${defaultBranch}.remote`, 'fork'], { cwd: repoPath })
const remote = await getDefaultRemote(repoPath)
Defensive patterns

Strategy: validation

Validate before calling

async function repoHasUnambiguousDefault(path: string, defaultBranch: string | null): Promise<boolean> {
  const { stdout } = await gitExecFileAsync(['remote'], { cwd: path })
  const remotes = stdout.split('\n').map((l) => l.trim()).filter(Boolean)
  if (remotes.length === 1 || remotes.includes('origin')) return true
  if (!defaultBranch) return false
  try {
    const { stdout: cfg } = await gitExecFileAsync(['config', '--get', `branch.${defaultBranch}.remote`], { cwd: path })
    return Boolean(cfg.trim())
  } catch { return false }
}

Type guard

function isAmbiguousRemotes(error: unknown): boolean {
  return error instanceof Error && /Repo has multiple remotes \(.+\) and no default is configured/.test(error.message)
}

Try / catch

try { return await getDefaultRemote(repoPath) }
catch (error) {
  if (isAmbiguousRemotes(error)) {
    await gitExecFileAsync(['config', `branch.${defaultBranch}.remote`, 'fork'], { cwd: repoPath })
    return await getDefaultRemote(repoPath)
  }
  throw error
}

Prevention

When it happens

Trigger: Calling getDefaultRemote on a repo with remotes like 'upstream' and 'fork' (no 'origin'), where the current default branch has no branch.<name>.remote config. The function refuses to guess which remote to push to.

Common situations: A fork-and-upstream workflow where 'origin' was renamed or never created; repos cloned then had 'origin' renamed to the fork name; multi-remote enterprise setups (e.g. 'github' + 'gitlab'); a branch checked out from one remote while the default branch tracks another and no branch.<default>.remote is set.

Related errors


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