{"record":{"id":"2e2382c748d3d935","repo":"vitessio/vitess","slug":"missing-golang-digest-for-distro-s","errorCode":null,"errorMessage":"missing golang digest for distro %s","messagePattern":"missing golang digest for distro (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/tools/go-upgrade/go-upgrade.go","lineNumber":501,"sourceCode":"\t}\n\n\tvar replaceErr error\n\treplaced := golangImageRegexp.ReplaceAllStringFunc(content, func(match string) string {\n\t\tif replaceErr != nil {\n\t\t\treturn match\n\t\t}\n\n\t\tsubmatch := golangImageRegexp.FindStringSubmatch(match)\n\t\tif len(submatch) != 3 {\n\t\t\treplaceErr = fmt.Errorf(\"malformatted golang image reference: %s\", match)\n\t\t\treturn match\n\t\t}\n\n\t\tprefix := submatch[1]\n\t\tdistro := submatch[2]\n\t\tdigest, ok := digestsByDistro[distro]\n\t\tif !ok {\n\t\t\treplaceErr = fmt.Errorf(\"missing golang digest for distro %s\", distro)\n\t\t\treturn match\n\t\t}\n\n\t\treturn fmt.Sprintf(\"%s%s@%s\", prefix, golangDockerTag(goVersion, distro), digest)\n\t})\n\tif replaceErr != nil {\n\t\treturn \"\", replaceErr\n\t}\n\n\treturn replaced, nil\n}\n\n// resolveGolangImageDigest resolves the pinned digest for the given Go version and distro.\nfunc resolveGolangImageDigest(goVersion *version.Version, distro string) (string, error) {\n\tref := \"golang:\" + golangDockerTag(goVersion, distro)\n\n\tdigest, err := crane.Digest(ref, crane.WithPlatform(&gocr.Platform{OS: dockerPlatformOS, Architecture: dockerPlatformArch}))\n\tif err != nil {","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/tools/go-upgrade/go-upgrade.go#L483-L519","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Fix typos in the distro tag of the golang image reference","Add the new distro to go-upgrade's supported distro list / digest source mapping","Refresh the digest lookup (the digestsByDistro map source) so it includes the distro","Temporarily switch the image to a supported distro tag and re-run go-upgrade"],"exampleFix":"// before (Dockerfile)\nFROM golang:1.23-trixie\n// after\nFROM golang:1.23-bookworm\n// or add \"trixie\" to the supported distro list in go-upgrade","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"bookworm\": true, \"bullseye\": true, \"alpine\": true}\ndistro := extractDistro(imageRef)\nif !supported[distro] {\n    return fmt.Errorf(\"distro %q has no pinned digest; fix the tag or add the distro to go-upgrade\", distro)\n}","typeGuard":"func distroHasDigest(digests map[string]string, ref string) bool {\n    m := golangImageRegexp.FindStringSubmatch(ref)\n    if len(m) != 3 { return false }\n    _, ok := digests[m[2]]\n    return ok\n}","tryCatchPattern":"if err := replaceGolangImageReferences(...); err != nil {\n    if strings.Contains(err.Error(), \"missing golang digest\") {\n        return fmt.Errorf(\"unsupported distro in image tag; use a supported one or update the digest map: %w\", err)\n    }\n    return err\n}","preventionTips":["Only use distro tags present in go-upgrade's supported list","Check spelling of distro tags when writing Dockerfiles manually","When a new distro ships (e.g. new Debian release), add it to the digest source proactively"],"tags":["docker","golang","versioning","ci"],"backgroundTag":"missing-image-digest","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}