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

  1. Delete the `path:` key from the module-type custom linter entry.
  2. 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

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


AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02). Data as JSON: /api/errors/647ecde94e964754. Report an issue: GitHub.