{"record":{"id":"43291820bca37d4e","repo":"golang/go","slug":"s-in-s-w","errorCode":null,"errorMessage":"%s (in %s): %w","messagePattern":"(.+?) \\(in (.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/load/pkg.go","lineNumber":3452,"sourceCode":"\tqrs, err := modload.QueryPackages(ld, ctx, patterns[0], version, noneSelected, allowed)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}\n\trootMod := qrs[0].Mod\n\tdeprecation, err := modload.CheckDeprecation(ld, ctx, rootMod)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}\n\tif deprecation != \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"go: module %s is deprecated: %s\\n\", rootMod.Path, modload.ShortMessage(deprecation, \"\"))\n\t}\n\tdata, err := ld.Fetcher().GoMod(ctx, rootMod.Path, rootMod.Version)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}\n\tf, err := modfile.Parse(\"go.mod\", data, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s (in %s): %w\", args[0], rootMod, err)\n\t}\n\tdirectiveFmt := \"%s (in %s):\\n\" +\n\t\t\"\\tThe go.mod file for the module providing named packages contains one or\\n\" +\n\t\t\"\\tmore %s directives. It must not contain directives that would cause\\n\" +\n\t\t\"\\tit to be interpreted differently than if it were the main module.\"\n\tif len(f.Replace) > 0 {\n\t\treturn nil, fmt.Errorf(directiveFmt, args[0], rootMod, \"replace\")\n\t}\n\tif len(f.Exclude) > 0 {\n\t\treturn nil, fmt.Errorf(directiveFmt, args[0], rootMod, \"exclude\")\n\t}\n\n\t// Since we are in NoRoot mode, the build list initially contains only\n\t// the dummy command-line-arguments module. Add a requirement on the\n\t// module that provides the packages named on the command line.\n\tif _, err := modload.EditBuildList(ld, ctx, nil, []module.Version{rootMod}); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", args[0], err)\n\t}","sourceCodeStart":3434,"sourceCodeEnd":3470,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/load/pkg.go#L3434-L3470","documentation":"Wraps a parse error from `modfile.Parse(\"go.mod\", data, nil)` on the fetched go.mod bytes. The target module's published go.mod is syntactically invalid or contains a construct the parser rejects (unclosed parentheses, bad directive, malformed version). This is a defect in the published module, not in the user's command.","triggerScenarios":"The module author published a version whose go.mod has malformed syntax — unclosed require block, invalid token, or a directive `modfile.Parse` does not understand under the current toolchain.","commonSituations":"Module maintainer shipped a broken go.mod; tooling version skew (older go.mod feature not parseable by an older toolchain); corrupted proxy cache.","solutions":["Pin to a different version of the module known to have a valid go.mod.","Report the broken go.mod to the module maintainer.","Clear the module cache (`go clean -modcache`) in case the cached .mod is corrupt.","Upgrade your Go toolchain in case the directive is valid but newer than your version."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Before committing to a version, check its go.mod parses.\nfunc verifyGoMod(mod, ver string) error {\n    cmd := exec.Command(\"go\", \"mod\", \"download\", \"-json\", mod+\"@\"+ver)\n    out, err := cmd.Output()\n    if err != nil { return err }\n    var info struct{ GoMod string }\n    return json.Unmarshal(out, &info)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin to versions you have validated rather than `@latest` in production scripts.","Validate a module's go.mod in CI before promoting it as a dependency.","Report parse errors upstream so the maintainer can retag."],"tags":["go-toolchain","go-mod","parse","module"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}