golang/go · warning

non-specific origin

Error message

non-specific origin

What it means

CheckReuse's repoSum branch: the current repo produced a non-empty RepoSum but old.RepoSum is empty, meaning the cached origin was recorded without a repo sum (older client or partial cache). Reuse is refused because the old origin is too vague to safely compare.

Source

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

			return nil
		}
		if err != nil {
			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{

View on GitHub (pinned to b6b368adc5)

Solutions

  1. `go clean -modcache` then re-download with the current toolchain — the new origin will carry a RepoSum.
  2. Standardise on a single Go toolchain version across the team to avoid origin-schema mismatches.
  3. Use GOPROXY so origins are always freshly minted by the proxy rather than persisted from mixed clients.
Defensive patterns

Strategy: fallback

Validate before calling

func originHasRepoSum(o *codehost.Origin) bool {
    return o != nil && o.RepoSum != ""
}

Try / catch

if err := repo.CheckReuse(ctx, old, subdir); err != nil {
    if strings.Contains(err.Error(), "non-specific origin") {
        // old cache entry from older toolchain — re-download
    }
}

Prevention

When it happens

Trigger: loadRepoSum populates r.repoSum, but old.RepoSum=="" — the prior origin predates repoSum support or was stored incompletely. Refers to the origin record being 'non-specific' rather than the module path.

Common situations: Mixing go toolchain versions across the same module cache (an older Go wrote an origin without RepoSum, a newer Go reads it); cache entry written by an interrupted download.

Related errors


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