{"record":{"id":"fa17025a081e636c","repo":"golangci/golangci-lint","slug":"invalid-relative-path-mode-s-only-s-allowed","errorCode":null,"errorMessage":"invalid relative path mode %s, only (%s) allowed","messagePattern":"invalid relative path mode (.+?), only \\((.+?)\\) allowed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/run.go","lineNumber":44,"sourceCode":"\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":26,"sourceCodeEnd":49,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/run.go#L26-L49","documentation":"This error comes from Run.Validate() when run.relative-path-mode is set to a value not present in fsutils.AllRelativePathModes(). Valid modes correspond to the fsutils RelativePathMode constants (go.mod, git root, working directory, etc.). The check keeps invalid path-resolution modes from reaching the runner.","triggerScenarios":"Setting run.relative-path-mode in .golangci.yml to an unsupported string (e.g. 'gomod-root', 'project') instead of one of the fsutils relative path modes, then running golangci-lint or Run.Validate().","commonSituations":"Typos like 'gitroot' instead of 'git-root'; copying values between golangci-lint major versions where mode names changed; guessing mode names without checking fsutils.","solutions":["Set run.relative-path-mode to a valid mode from fsutils.AllRelativePathModes() (e.g. gomod, git-root, wd)","Remove the key to use the default mode","Check the fsutils basepath.go switch cases for the exact accepted strings in your version"],"exampleFix":"// before\nrun:\n  relative-path-mode: gitroot\n// after\nrun:\n  relative-path-mode: git-root","handlingStrategy":"validation","validationCode":"validModes := fsutils.AllRelativePathModes()\nif cfg.Run.RelativePathMode != \"\" && !slices.Contains(validModes, cfg.Run.RelativePathMode) {\n  return fmt.Errorf(\"relative-path-mode must be one of %v\", validModes)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use fsutils.RelativePathMode* constants when building config programmatically","Run `golangci-lint config verify` in CI","Check mode names against your pinned golangci-lint version"],"tags":["config","validation","path-mode"],"backgroundTag":"invalid-config-value","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}