golang/go · info

vcs %s: CheckReuse: %w

Error message

vcs %s: CheckReuse: %w

What it means

CheckReuse fallback: the current repo produced no RepoSum (r.repoSum==""), so none of the prior branches could verify reuse. The error wraps errors.ErrUnsupported, signalling that this VCS cannot deterministically confirm identity. The %s is the VCS name.

Source

Thrown at src/cmd/go/internal/modfetch/codehost/vcs.go:420

	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{},
	}
	for tag := range r.tags {
		if strings.HasPrefix(tag, prefix) {
			tags.List = append(tags.List, Tag{tag, ""})
		}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Use GOPROXY so the module zip is served without invoking VCS reuse checks.
  2. Accept that reuse cannot be verified and let the go command re-download each time (slow but correct).
  3. Migrate the upstream repo to git or hg, which support repoSum and enable reuse caching.
  4. If svn is required, ensure the svn binary and remote are reachable so loadRepoSum does not silently fail.
Defensive patterns

Strategy: fallback

Validate before calling

func vcsSupportsRepoSum(vcs string) bool {
    return vcs == "git" || vcs == "hg"
}

Try / catch

if err := repo.CheckReuse(ctx, old, subdir); err != nil {
    if errors.Is(err, errors.ErrUnsupported) {
        // VCS cannot verify reuse — re-download unconditionally
    }
}

Prevention

When it happens

Trigger: loadRepoSum returned empty (cmd.repoSum==nil or the sum command failed silently) AND no hash/ref branch matched —svn and fossil typically land here because svn has no repoSum command.

Common situations: svn-backed vanity import being checked for reuse; fossil repo whose `fossil info` produced no parseable sum; a transient failure in loadRepoSum left repoSum empty.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/73a9a5e1b407c4d8. Report an issue: GitHub.