{"record":{"id":"7c218476def6c071","repo":"golangci/golangci-lint","slug":"invalid-modules-download-path-s-only-s-allowe","errorCode":null,"errorMessage":"invalid modules download path %s, only (%s) allowed","messagePattern":"invalid modules download path (.+?), only \\((.+?)\\) allowed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/run.go","lineNumber":38,"sourceCode":"\tRelativePathMode string `mapstructure:\"relative-path-mode\"`\n\n\tBuildTags           []string `mapstructure:\"build-tags\"`\n\tModulesDownloadMode string   `mapstructure:\"modules-download-mode\"`\n\tEnableBuildVCS      bool     `mapstructure:\"enable-build-vcs\"`\n\n\tExitCodeIfIssuesFound int  `mapstructure:\"issues-exit-code\"`\n\tAnalyzeTests          bool `mapstructure:\"tests\"`\n\n\tAllowParallelRunners bool `mapstructure:\"allow-parallel-runners\"`\n\tAllowSerialRunners   bool `mapstructure:\"allow-serial-runners\"`\n}\n\nfunc (r *Run) Validate() error {\n\t// go help modules\n\tallowedModes := []string{\"mod\", \"readonly\", \"vendor\"}\n\n\tif r.ModulesDownloadMode != \"\" && !slices.Contains(allowedModes, r.ModulesDownloadMode) {\n\t\treturn fmt.Errorf(\"invalid modules download path %s, only (%s) allowed\", r.ModulesDownloadMode, strings.Join(allowedModes, \"|\"))\n\t}\n\n\tpathRelativeToModes := fsutils.AllRelativePathModes()\n\n\tif r.RelativePathMode != \"\" && !slices.Contains(pathRelativeToModes, r.RelativePathMode) {\n\t\treturn fmt.Errorf(\"invalid relative path mode %s, only (%s) allowed\", r.RelativePathMode, strings.Join(pathRelativeToModes, \"|\"))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":20,"sourceCodeEnd":49,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/run.go#L20-L49","documentation":"This error comes from Run.Validate() when run.modules-download-mode is set to a value other than one of the Go module download modes allowed by `go help modules`: 'mod', 'readonly', or 'vendor'. The value is passed through to the go toolchain, so anything invalid is rejected early. It is a configuration allowlist check, not a runtime failure.","triggerScenarios":"Setting run.modules-download-mode in .golangci.yml to e.g. 'ReadOnly', 'mod-mode', or an empty-but-nonblank string, then running golangci-lint or Run.Validate().","commonSituations":"Capitalization mistakes ('Mod' vs 'mod'); using GOFLAGS-style values that aren't valid -mod flags; confusing this setting with unrelated download options.","solutions":["Set run.modules-download-mode to exactly one of: mod, readonly, vendor","Or remove the run.modules-download-mode key to leave the go toolchain default (readonly)","Match the lowercase spelling exactly as shown by `go help modules`"],"exampleFix":"// before\nrun:\n  modules-download-mode: ReadOnly\n// after\nrun:\n  modules-download-mode: readonly","handlingStrategy":"validation","validationCode":"allowed := []string{\"\", \"mod\", \"readonly\", \"vendor\"}\nif !slices.Contains(allowed, cfg.Run.ModulesDownloadMode) {\n  return fmt.Errorf(\"modules-download-mode must be one of mod|readonly|vendor\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use lowercase exact values from `go help modules`","Omit the key when the go default (readonly) is acceptable","Validate config in CI before running lint"],"tags":["config","go-modules","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}