{"record":{"id":"a63824b493715b0d","repo":"golang/go","slug":"repo-changed","errorCode":null,"errorMessage":"repo changed","messagePattern":"repo changed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cmd/go/internal/modfetch/codehost/vcs.go","lineNumber":416,"sourceCode":"\t\t\treturn fmt.Errorf(\"looking up hash: %v\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"hash changed\") // weird but maybe they made a tag\n\t}\n\n\tif old.Ref != \"\" && old.RepoSum == \"\" {\n\t\thash, err := r.lookupRef(ctx, old.Ref)\n\t\tif err == nil && hash != \"\" && hash == old.Hash {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tr.repoSumOnce.Do(func() { r.loadRepoSum(ctx) })\n\tif r.repoSum != \"\" {\n\t\tif old.RepoSum == \"\" {\n\t\t\treturn fmt.Errorf(\"non-specific origin\")\n\t\t}\n\t\tif old.RepoSum != r.repoSum {\n\t\t\treturn fmt.Errorf(\"repo changed\")\n\t\t}\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"vcs %s: CheckReuse: %w\", r.cmd.vcs, errors.ErrUnsupported)\n}\n\nfunc (r *vcsRepo) Tags(ctx context.Context, prefix string) (*Tags, error) {\n\tunlock, err := r.mu.Lock()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer unlock()\n\n\tr.tagsOnce.Do(func() { r.loadTags(ctx) })\n\ttags := &Tags{\n\t\tOrigin: r.repoSumOrigin(ctx),\n\t\tList:   []Tag{},\n\t}","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/codehost/vcs.go#L398-L434","documentation":"CheckReuse repoSum branch: both old and current RepoSum are populated but differ. The repository's content fingerprint changed, indicating upstream history was rewritten, the remote is a different clone, or the sum algorithm differs.","triggerScenarios":"old.RepoSum != r.repoSum after loadRepoSum completes — the repo's deterministic content hash diverged from what was cached.","commonSituations":"Upstream rebased or force-pushed history; the module is served from a mirror whose content differs from the originally-cached remote; hg repository reorganisation affecting the goreposum.py output.","solutions":["Confirm the upstream change is intentional (check the VCS for recent force-pushes/rebases).","`go clean -modcache` to discard the stale sum and re-establish a baseline against the current remote.","Pin the module to a specific version tag so the same commit is always resolved.","If using a mirror, ensure all clients point at the same mirror consistently."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"func repoSumStable(oldSum, currentSum string) bool {\n    return oldSum != \"\" && oldSum == currentSum\n}","typeGuard":null,"tryCatchPattern":"if err := repo.CheckReuse(ctx, old, subdir); err != nil {\n    if strings.Contains(err.Error(), \"repo changed\") {\n        // history rewritten upstream — re-baseline the cache\n    }\n}","preventionTips":["Do not rewrite published repository history.","Pin modules to immutable tags and verify go.sum checksums on CI.","Use a single canonical mirror for each upstream repo."],"tags":["vcs","checkreuse","reposum","force-push","mirror"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}