vitessio/vitess · error

missing golang digest for distro %s

Error message

missing golang digest for distro %s

What it means

After parsing a golang image reference and extracting its distro (e.g. bookworm, alpine), go-upgrade looks up the pinned image digest for that distro. If the digest map has no entry for the distro, it sets replaceErr to this error and skips rewriting the reference, failing the upgrade run.

Source

Thrown at go/tools/go-upgrade/go-upgrade.go:501

	}

	var replaceErr error
	replaced := golangImageRegexp.ReplaceAllStringFunc(content, func(match string) string {
		if replaceErr != nil {
			return match
		}

		submatch := golangImageRegexp.FindStringSubmatch(match)
		if len(submatch) != 3 {
			replaceErr = fmt.Errorf("malformatted golang image reference: %s", match)
			return match
		}

		prefix := submatch[1]
		distro := submatch[2]
		digest, ok := digestsByDistro[distro]
		if !ok {
			replaceErr = fmt.Errorf("missing golang digest for distro %s", distro)
			return match
		}

		return fmt.Sprintf("%s%s@%s", prefix, golangDockerTag(goVersion, distro), digest)
	})
	if replaceErr != nil {
		return "", replaceErr
	}

	return replaced, nil
}

// resolveGolangImageDigest resolves the pinned digest for the given Go version and distro.
func resolveGolangImageDigest(goVersion *version.Version, distro string) (string, error) {
	ref := "golang:" + golangDockerTag(goVersion, distro)

	digest, err := crane.Digest(ref, crane.WithPlatform(&gocr.Platform{OS: dockerPlatformOS, Architecture: dockerPlatformArch}))
	if err != nil {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Fix typos in the distro tag of the golang image reference
  2. Add the new distro to go-upgrade's supported distro list / digest source mapping
  3. Refresh the digest lookup (the digestsByDistro map source) so it includes the distro
  4. Temporarily switch the image to a supported distro tag and re-run go-upgrade

Example fix

// before (Dockerfile)
FROM golang:1.23-trixie
// after
FROM golang:1.23-bookworm
// or add "trixie" to the supported distro list in go-upgrade
Defensive patterns

Strategy: validation

Validate before calling

supported := map[string]bool{"bookworm": true, "bullseye": true, "alpine": true}
distro := extractDistro(imageRef)
if !supported[distro] {
    return fmt.Errorf("distro %q has no pinned digest; fix the tag or add the distro to go-upgrade", distro)
}

Type guard

func distroHasDigest(digests map[string]string, ref string) bool {
    m := golangImageRegexp.FindStringSubmatch(ref)
    if len(m) != 3 { return false }
    _, ok := digests[m[2]]
    return ok
}

Try / catch

if err := replaceGolangImageReferences(...); err != nil {
    if strings.Contains(err.Error(), "missing golang digest") {
        return fmt.Errorf("unsupported distro in image tag; use a supported one or update the digest map: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: A Dockerfile or workflow uses a golang image with a distro tag for which go-upgrade has no cached/fetched digest — e.g. a newly released distro variant (e.g. `golang:1.23-trixie`) before digests are resolved, or a typo'd distro tag like `goalm`/`bookwarm`.

Common situations: New Debian/Alpine release cycle introduces a distro tag not yet in the digest source; hand-written image lines with misspelled distro names; stale digest cache missing recently added distros.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/2e2382c748d3d935. Report an issue: GitHub.