golangci/golangci-lint · error
path not supported with module type
Error message
path not supported with module type
What it means
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.
Source
Thrown at pkg/config/linters_settings.go:1251
Type string `mapstructure:"type"`
// Path to a plugin *.so file that implements the private linter.
// Only for Go plugin system.
Path string `mapstructure:"path"`
// Description describes the purpose of the private linter.
Description string `mapstructure:"description"`
// OriginalURL The URL containing the source code for the private linter.
OriginalURL string `mapstructure:"original-url"`
// Settings plugin settings only work with linterdb.PluginConstructor symbol.
Settings any `mapstructure:"settings"`
}
func (s *CustomLinterSettings) Validate() error {
if s.Type == "module" {
if s.Path != "" {
return errors.New("path not supported with module type")
}
return nil
}
if s.Path == "" {
return errors.New("path is required")
}
return nil
}
View on GitHub (pinned to ed7a235d2d)
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.
Example fix
# before
linters-settings:
custom:
mylint:
type: module
path: /plugins/mylint.so
# after
linters-settings:
custom:
mylint:
type: module
description: my lint module Defensive patterns
Strategy: validation
Validate before calling
for (const [name, s] of Object.entries(cfg['linters-settings']?.custom ?? {})) {
if (s.type === 'module' && s.path) {
throw new Error(`custom linter "${name}": drop "path" when type is module`);
}
} Prevention
- 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.
When it happens
Trigger: A `linters-settings.custom` entry with `type: module` and a non-empty `path:` key, validated during config load.
Common situations: 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.
Related errors
- path is required
- no plugins defined
- can't combine option --config and --no-config
- failed to expand configuration path
- can't get config directory
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/647ecde94e964754.
Report an issue: GitHub.