{"record":{"id":"6ea29b5b7457f250","repo":"golang/go","slug":"s-has-post-s-module-path-q-s-at-revision-s","errorCode":null,"errorMessage":"%s has post-%s module path %q%s at revision %s","messagePattern":"(.+?) has post-(.+?) module path %q(.+?) at revision (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/coderepo.go","lineNumber":902,"sourceCode":"\t\t// Explicit go.mod with matching major version ok.\n\t\treturn rev, r.codeDir, gomod1, nil\n\t}\n\tif err1 == nil {\n\t\t// Explicit go.mod with non-matching major version disallowed.\n\t\tsuffix := \"\"\n\t\tif file2 != \"\" {\n\t\t\tsuffix = fmt.Sprintf(\" (and ...%s/go.mod does not exist)\", r.pathMajor)\n\t\t}\n\t\tif mpath1 == \"\" {\n\t\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s is missing module path%s at revision %s\", file1, suffix, rev)\n\t\t}\n\t\tif r.pathMajor != \"\" { // \".v1\", \".v2\" for gopkg.in\n\t\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s has non-...%s module path %q%s at revision %s\", file1, r.pathMajor, mpath1, suffix, rev)\n\t\t}\n\t\tif _, _, ok := module.SplitPathVersion(mpath1); !ok {\n\t\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s has malformed module path %q%s at revision %s\", file1, mpath1, suffix, rev)\n\t\t}\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s has post-%s module path %q%s at revision %s\", file1, semver.Major(version), mpath1, suffix, rev)\n\t}\n\n\tif r.codeDir == \"\" && (r.pathMajor == \"\" || strings.HasPrefix(r.pathMajor, \".\")) {\n\t\t// Implicit go.mod at root of repo OK for v0/v1 and for gopkg.in.\n\t\treturn rev, \"\", nil, nil\n\t}\n\n\t// Implicit go.mod below root of repo or at v2+ disallowed.\n\t// Be clear about possibility of using either location for v2+.\n\tif file2 != \"\" {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"missing %s/go.mod and ...%s/go.mod at revision %s\", r.pathPrefix, r.pathMajor, rev)\n\t}\n\treturn \"\", \"\", nil, fmt.Errorf(\"missing %s/go.mod at revision %s\", r.pathPrefix, rev)\n}\n\n// isMajor reports whether the versions allowed for mpath are compatible with\n// the major version(s) implied by pathMajor, or false if mpath has an invalid\n// version suffix.","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/coderepo.go#L884-L920","documentation":"findDir (coderepo.go:901-903). The root go.mod declares a module path that parses cleanly but whose declared major version is HIGHER than semver.Major(version) being resolved. Example: resolving v1.2.3 but go.mod says `module example.com/m/v2`. pathMajor is empty (no gopkg.in suffix) and the structural checks pass, so we reach this 'post-major' clause.","triggerScenarios":"Depending on v1.x of a module whose go.mod at that revision already declares a v2 module path — i.e. the repo's go.mod was bumped to v2 before the v1 tag was made, or the wrong revision is being read.","commonSituations":"Major-version migration done in-place (root go.mod rewritten to /v2) while old v1 tags still point at pre-bump commits; requesting an old version after an in-place major bump; misaligned tags and go.mod state.","solutions":["If the module uses in-place major bumps, request a v2 version (`go get example.com/m/v2@v2.x.x`).","If using the major-subdir layout, ensure the v1 tag's go.mod still declares a v1 module path.","Tag a corrected revision so the major version in go.mod matches the tag's major."],"exampleFix":"// before\n// go get example.com/m@v1.2.3   // but go.mod at v1.2.3 says module example.com/m/v2\n\n// after\n// go get example.com/m/v2@v2.0.0   // match the declared major","handlingStrategy":"validation","validationCode":"// The major version of the request must be >= the major declared in go.mod.\n// bash:\n//   requested_major='v1'\n//   declared_major=$(grep -oE '/v[0-9]+\"?$' <(grep '^module ' go.mod) | tr -d '\"')\n//   # if declared_major > requested_major, the dependency is wrong\n//\n// Easier: let the toolchain resolve:\n//   go get example.com/m/v2@v2.0.0   // import path includes /v2","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When doing in-place major bumps, immediately tag the new major and stop depending on old majors.","Include the major suffix in the import path for v2+ modules.","After bumping go.mod's module path, retag rather than reusing old version numbers."],"tags":["go-modules","go-mod","module-path","major-version"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}