golang/go · warning
repo changed
Error message
repo changed
What it means
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.
Source
Thrown at src/cmd/go/internal/modfetch/codehost/vcs.go:416
return fmt.Errorf("looking up hash: %v", err)
}
return fmt.Errorf("hash changed") // weird but maybe they made a tag
}
if old.Ref != "" && old.RepoSum == "" {
hash, err := r.lookupRef(ctx, old.Ref)
if err == nil && hash != "" && hash == old.Hash {
return nil
}
}
r.repoSumOnce.Do(func() { r.loadRepoSum(ctx) })
if r.repoSum != "" {
if old.RepoSum == "" {
return fmt.Errorf("non-specific origin")
}
if old.RepoSum != r.repoSum {
return fmt.Errorf("repo changed")
}
return nil
}
return fmt.Errorf("vcs %s: CheckReuse: %w", r.cmd.vcs, errors.ErrUnsupported)
}
func (r *vcsRepo) Tags(ctx context.Context, prefix string) (*Tags, error) {
unlock, err := r.mu.Lock()
if err != nil {
return nil, err
}
defer unlock()
r.tagsOnce.Do(func() { r.loadTags(ctx) })
tags := &Tags{
Origin: r.repoSumOrigin(ctx),
List: []Tag{},
}View on GitHub (pinned to b6b368adc5)
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.
Defensive patterns
Strategy: fallback
Validate before calling
func repoSumStable(oldSum, currentSum string) bool {
return oldSum != "" && oldSum == currentSum
} Try / catch
if err := repo.CheckReuse(ctx, old, subdir); err != nil {
if strings.Contains(err.Error(), "repo changed") {
// history rewritten upstream — re-baseline the cache
}
} Prevention
- 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.
When it happens
Trigger: old.RepoSum != r.repoSum after loadRepoSum completes — the repo's deterministic content hash diverged from what was cached.
Common situations: 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.
Related errors
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/a63824b493715b0d.
Report an issue: GitHub.