{"record":{"id":"94b5bf8b691cacd6","repo":"golang/go","slug":"does-not-match-short-name-of-revision-expected-s","errorCode":null,"errorMessage":"does not match short name of revision (expected %s)","messagePattern":"does not match short name of revision \\(expected (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/coderepo.go","lineNumber":701,"sourceCode":"\t\t\t\t\terr = &module.InvalidVersionError{Version: version, Pseudo: true, Err: err}\n\t\t\t\t}\n\t\t\t\terr = &module.ModuleError{Path: r.modPath, Err: err}\n\t\t\t}\n\t\t}\n\t}()\n\n\trev, err := module.PseudoVersionRev(version)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif rev != info.Short {\n\t\tswitch {\n\t\tcase strings.HasPrefix(rev, info.Short):\n\t\t\treturn fmt.Errorf(\"revision is longer than canonical (expected %s)\", info.Short)\n\t\tcase strings.HasPrefix(info.Short, rev):\n\t\t\treturn fmt.Errorf(\"revision is shorter than canonical (expected %s)\", info.Short)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"does not match short name of revision (expected %s)\", info.Short)\n\t\t}\n\t}\n\n\tt, err := module.PseudoVersionTime(version)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !t.Equal(info.Time.Truncate(time.Second)) {\n\t\treturn fmt.Errorf(\"does not match version-control timestamp (expected %s)\", info.Time.UTC().Format(module.PseudoVersionTimestampFormat))\n\t}\n\n\ttagPrefix := \"\"\n\tif r.codeDir != \"\" {\n\t\ttagPrefix = r.codeDir + \"/\"\n\t}\n\n\t// A pseudo-version should have a precedence just above its parent revisions,\n\t// and no higher. Otherwise, it would be possible for library authors to \"pin\"","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/coderepo.go#L683-L719","documentation":"Default branch of the same hash comparison in validatePseudoVersion (coderepo.go:694-703). Neither the embedded rev nor info.Short is a prefix of the other, so the commit named by the pseudo-version simply is not the commit the VCS reports at that revision. The pseudo-version names a different commit than the one actually fetched.","triggerScenarios":"A pseudo-version was copied from a different module/branch/fork; the VCS rewrote history (rebase/force-push) so the hash now points elsewhere or no longer exists; a proxy served a zip whose head commit differs from the recorded pseudo-version metadata.","commonSituations":"Force-pushed upstream branches; squashed-merge workflows that invalidate old commit hashes; copy-paste errors between dependencies; mismatched go.sum entries after a upstream rewrite.","solutions":["Re-derive the pseudo-version from the current commit: `go get <module>@<branch-or-tag>` and let the toolchain compute it.","If upstream rewrote history, `go clean -modcache` and re-resolve; coordinate with upstream about force-pushes.","Verify the commit hash actually exists in the source repo (`git cat-file -e <hash>^{commit}`)."],"exampleFix":"// before (hash does not match fetched commit)\nrequire example.com/m v0.0.0-20240101120000-e3702bed3d42\n\n// after\nrequire example.com/m v0.0.0-20240101120000-a1b2c3d4e5f6   // correct hash for the intended commit","handlingStrategy":"validation","validationCode":"// Confirm the embedded hash still exists and matches the fetched commit.\n// bash:\n//   git cat-file -e <embedded-hash>^{commit} || echo \"hash missing\"\n//\n// In CI, after `go mod download`, verify go.sum entries match upstream:\n//   go mod verify","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat upstream force-pushes/rebases as breaking changes; re-derive pseudo-versions.","Pin to tags rather than commits when history is volatile.","Run `go mod verify` in CI to catch checksum/history mismatches."],"tags":["go-modules","pseudo-version","vcs-revision","history-rewrite"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}