{"record":{"id":"e72063722b18f9c7","repo":"stablyai/orca","slug":"ssh-git-provider-is-not-available-reconnect-to-th","errorCode":null,"errorMessage":"SSH Git provider is not available. Reconnect to this target and try again.","messagePattern":"SSH Git provider is not available\\. Reconnect to this target and try again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/github/pr-head-tracking-ref.ts","lineNumber":34,"sourceCode":"// Why: the relay's read-only git.exec channel rejects `fetch`, so SSH repos\n// must use the dedicated git.fetchRemoteTrackingRef RPC.\nexport async function fetchPrHeadTrackingRef(\n  repo: { path: string; connectionId?: string | null },\n  sshGitProvider: SshGitProvider | null | undefined,\n  remote: string,\n  branch: string,\n  options: { localGitExecOptions?: LocalGitExecOptions } = {}\n): Promise<void> {\n  const ref = `refs/remotes/${remote}/${branch}`\n  if (!repo.connectionId) {\n    await gitExecFileAsync(\n      ['fetch', remote, `+refs/heads/${branch}:${ref}`],\n      options.localGitExecOptions ?? { cwd: repo.path }\n    )\n    return\n  }\n  if (!sshGitProvider) {\n    throw new Error('SSH Git provider is not available. Reconnect to this target and try again.')\n  }\n  await sshGitProvider.fetchRemoteTrackingRef(repo.path, remote, branch, ref)\n}\n\nexport async function fetchGitHubPullRequestHeadRef(\n  repo: { path: string; connectionId?: string | null },\n  sshGitProvider: SshGitProvider | null | undefined,\n  remote: string,\n  prNumber: number,\n  options: { localGitExecOptions?: LocalGitExecOptions } = {}\n): Promise<string> {\n  if (!isValidReviewHeadNumber(prNumber)) {\n    throw new Error(`Invalid pull request number: ${String(prNumber)}`)\n  }\n  if (!isSafeReviewHeadFetchRemote(remote)) {\n    throw new Error('Pull request fetch remote must not start with \"-\".')\n  }\n  if (!repo.connectionId) {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/github/pr-head-tracking-ref.ts#L16-L52","documentation":"Thrown by fetchPrHeadTrackingRef when repo.connectionId is set (SSH/relay target) but the sshGitProvider argument is null or undefined. The relay's read-only git.exec channel rejects `fetch`, so SSH repos must use the dedicated git.fetchRemoteTrackingRef RPC exposed by the provider. A missing provider means the connection's git provider was not wired (or was lost) when the call was made.","triggerScenarios":"Calling fetchPrHeadTrackingRef during early connection setup before the provider registered; the SSH connection dropped and the provider was torn down while a refresh was in flight; a code path that forgot to inject the provider; reconnect in progress.","commonSituations":"Refresh firing mid-reconnect; relay restart dropping the provider handle; provider registration race during target switch.","solutions":["Reconnect to the SSH target — this re-registers the git provider.","Retry the PR-head tracking refresh after reconnect succeeds.","If it persists, verify the relay process is healthy and the connection shows as active in the UI."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function assertSshProviderReady(connectionId: string | null | undefined, provider: unknown) {\n  if (connectionId && !provider) {\n    throw new Error('SSH Git provider is not available. Reconnect to this target and try again.')\n  }\n}","typeGuard":"function hasSshGitProvider(p: unknown): p is { fetchRemoteTrackingRef: Function } {\n  return !!p && typeof (p as any).fetchRemoteTrackingRef === 'function'\n}","tryCatchPattern":"try {\n  await fetchPrHeadTrackingRef(repo, sshGitProvider, remote, branch)\n} catch (err) {\n  if (/SSH Git provider is not available/.test((err as Error).message)) {\n    promptReconnect(target)\n    return\n  }\n  throw err\n}","preventionTips":["Ensure the SSH connection is fully established before triggering PR-head refreshes.","Do not call this function during reconnect; wait for the connection-ready signal.","Treat provider-unavailable as transient — reconnect and retry, do not show a permanent failure."],"tags":["ssh","relay","git-provider","fetch","connection"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}