{"record":{"id":"647ecde94e964754","repo":"golangci/golangci-lint","slug":"path-not-supported-with-module-type","errorCode":null,"errorMessage":"path not supported with module type","messagePattern":"path not supported with module type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/linters_settings.go","lineNumber":1251,"sourceCode":"\tType string `mapstructure:\"type\"`\n\n\t// Path to a plugin *.so file that implements the private linter.\n\t// Only for Go plugin system.\n\tPath string `mapstructure:\"path\"`\n\n\t// Description describes the purpose of the private linter.\n\tDescription string `mapstructure:\"description\"`\n\t// OriginalURL The URL containing the source code for the private linter.\n\tOriginalURL string `mapstructure:\"original-url\"`\n\n\t// Settings plugin settings only work with linterdb.PluginConstructor symbol.\n\tSettings any `mapstructure:\"settings\"`\n}\n\nfunc (s *CustomLinterSettings) Validate() error {\n\tif s.Type == \"module\" {\n\t\tif s.Path != \"\" {\n\t\t\treturn errors.New(\"path not supported with module type\")\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tif s.Path == \"\" {\n\t\treturn errors.New(\"path is required\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":1233,"sourceCodeEnd":1263,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/linters_settings.go#L1233-L1263","documentation":"CustomLinterSettings.Validate: a custom linter declared with `type: module` is loaded as a Go module, which derives its location from the module system, so an explicit `path` is not allowed. Providing both makes the source ambiguous and fails validation.","triggerScenarios":"A `linters-settings.custom` entry with `type: module` and a non-empty `path:` key, validated during config load.","commonSituations":"Converting a plugin config from the path-based (non-module) form to module form but leaving `path:` in place; copy-pasting an existing plugin entry.","solutions":["Delete the `path:` key from the module-type custom linter entry.","Keep `path:` and remove `type: module` if you want path-based plugin loading."],"exampleFix":"# before\nlinters-settings:\n  custom:\n    mylint:\n      type: module\n      path: /plugins/mylint.so\n\n# after\nlinters-settings:\n  custom:\n    mylint:\n      type: module\n      description: my lint module","handlingStrategy":"validation","validationCode":"for (const [name, s] of Object.entries(cfg['linters-settings']?.custom ?? {})) {\n  if (s.type === 'module' && s.path) {\n    throw new Error(`custom linter \"${name}\": drop \"path\" when type is module`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use module type => module reference only; path type => path only.","Verify custom linter entries after migrating between plugin styles.","Run `golangci-lint config verify` in CI."],"tags":["custom-linters","plugins","configuration"],"backgroundTag":"mutually-exclusive-config-options","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}