{"record":{"id":"ba14d783a07ff4be","repo":"mislav/hub","slug":"can-t-load-rev-list-for-s","errorCode":null,"errorMessage":"Can't load rev-list for %s","messagePattern":"Can't load rev-list for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"git/git.go","lineNumber":159,"sourceCode":"\nfunc Ref(ref string) (string, error) {\n\tparseCmd := gitCmd(\"rev-parse\", \"-q\", ref)\n\tparseCmd.Stderr = nil\n\toutput, err := parseCmd.Output()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Unknown revision or path not in the working tree: %s\", ref)\n\t}\n\n\treturn firstLine(output), nil\n}\n\nfunc RefList(a, b string) ([]string, error) {\n\tref := fmt.Sprintf(\"%s...%s\", a, b)\n\tlistCmd := gitCmd(\"rev-list\", \"--cherry-pick\", \"--right-only\", \"--no-merges\", ref)\n\tlistCmd.Stderr = nil\n\toutput, err := listCmd.Output()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Can't load rev-list for %s\", ref)\n\t}\n\n\treturn outputLines(output), nil\n}\n\nfunc NewRange(a, b string) (*Range, error) {\n\tparseCmd := gitCmd(\"rev-parse\", \"-q\", a, b)\n\tparseCmd.Stderr = nil\n\toutput, err := parseCmd.Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlines := outputLines(output)\n\tif len(lines) != 2 {\n\t\treturn nil, fmt.Errorf(\"Can't parse range %s..%s\", a, b)\n\t}\n\treturn &Range{lines[0], lines[1]}, nil","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/git/git.go#L141-L177","documentation":"RefList() runs `git rev-list --cherry-pick --right-only --no-merges a...b` to list commits reachable from b but not a. If rev-list fails (invalid refs, unrelated histories, missing objects), the library wraps it as \"Can't load rev-list for <a>...<b>\".","triggerScenarios":"Calling git.RefList(a, b) (via pullRequest, TestGitRefList) where a or b are unknown refs, or the symmetric range a...b cannot be computed (unrelated histories, shallow clone missing objects).","commonSituations":"Base branch name typo; comparing branches across repos with no common ancestor; shallow clones lacking the merge-base; fork PRs whose base commit isn't fetched.","solutions":["Verify both refs resolve: git rev-parse <a> <b>","Fetch the base branch first (git fetch origin <base>)","If histories are unrelated, use an explicit merge-base or correct base ref","Deepen a shallow clone: git fetch --unshallow"],"exampleFix":"// before\nlist, err := git.RefList(\"main\", \"feature\")\n// after\nif _, err := git.Ref(\"main\"); err != nil {\n    return fmt.Errorf(\"base ref %q not found; fetch first\", \"main\")\n}\nlist, err := git.RefList(\"main\", \"feature\")","handlingStrategy":"validation","validationCode":"for _, r := range []string{a, b} {\n    if exec.Command(\"git\", \"rev-parse\", \"-q\", \"--verify\", r).Run() != nil {\n        return fmt.Errorf(\"ref %q does not exist; fetch before comparing\", r)\n    }\n}","typeGuard":null,"tryCatchPattern":"list, err := git.RefList(a, b)\nif err != nil {\n    return fmt.Errorf(\"cannot compute %s...%s; fetch base and ensure shared history\", a, b)\n}","preventionTips":["Fetch both endpoints before computing ranges","Ensure clones have enough depth to include the merge-base","Avoid comparing unrelated histories","Pre-check refs with git rev-parse"],"tags":["git","rev-list","range","refs"],"backgroundTag":"unknown-revision","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}