{"record":{"id":"fe06178134715f3e","repo":"yamadashy/repomix","slug":"failed-to-get-remote-refs-redacterrormessage-er","errorCode":null,"errorMessage":"Failed to get remote refs: ${redactErrorMessage(error)}","messagePattern":"Failed to get remote refs: (.+?)","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/core/git/gitRemoteHandle.ts","lineNumber":59,"sourceCode":"    // Format is: hash\\tref_name\n    const refs = stdout\n      .split('\\n')\n      .filter(Boolean)\n      .map((line) => {\n        // Skip the hash part and extract only the ref name\n        const parts = line.split('\\t');\n        if (parts.length < 2) return '';\n\n        // Remove 'refs/heads/' or 'refs/tags/' prefix\n        return parts[1].replace(/^refs\\/(heads|tags)\\//, '');\n      })\n      .filter(Boolean);\n\n    logger.trace(`Found ${refs.length} refs in repository: ${redactUrl(url)}`);\n    return refs;\n  } catch (error) {\n    logger.trace('Failed to get remote refs:', redactErrorMessage(error));\n    throw new RepomixError(`Failed to get remote refs: ${redactErrorMessage(error)}`);\n  }\n};\n","sourceCodeStart":41,"sourceCodeEnd":62,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/git/gitRemoteHandle.ts#L41-L62","documentation":"Repomix wraps any failure while listing a remote repository's refs (branches/tags) into this RepomixError, with the underlying git command error redacted so credentials are not leaked. It means the `git ls-remote`-style operation against `url` did not succeed.","triggerScenarios":"getRemoteRefs(url) fails because the remote is unreachable, authentication failed, the repository does not exist or is private, the URL scheme is unsupported, or git is not installed/offline.","commonSituations":"Expired/missing credentials for a private repo; typo in remote URL; corporate proxy or firewall blocking git; cloning on a machine without git credentials configured (ssh keys, GCM token); network outage in CI.","solutions":["Read the redacted cause in the message to identify auth vs network failure.","Run `git ls-remote <url>` manually to reproduce and see the full git error.","Fix credentials: configure SSH keys or a token (git credential helper) for the host.","Verify the URL and network (VPN/proxy/DNS) then retry."],"exampleFix":"// before\nawait getRemoteRefs('git@github.com:org/private-repo.git'); // fails: no SSH key\n// after: ensure key exists or use HTTPS with token\nawait getRemoteRefs('https://github.com/org/private-repo.git');","handlingStrategy":"retry","validationCode":"import { execFileSync } from 'node:child_process';\nconst probe = (url: string) => execFileSync('git', ['ls-remote', url, 'HEAD'], { stdio: 'pipe' });\n// call before repomix: probe(url) throws with the full git error if unreachable","typeGuard":"null","tryCatchPattern":"try {\n  await repomixCli.run(['--remote', url]);\n} catch (e) {\n  if (String(e?.message).startsWith('Failed to get remote refs')) {\n    // retry with backoff for transient network errors; surface cause for auth issues\n  }\n}","preventionTips":["Run `git ls-remote <url>` first to verify reachability and credentials.","Configure credential helpers / SSH keys non-interactively in CI.","Use HTTPS+token URLs in ephemeral CI environments.","Retry with exponential backoff for transient network failures."],"tags":["git","network","authentication","remote"],"backgroundTag":"git-ls-remote-failed","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}