golangci/golangci-lint · error

plugin(%s): newPlugin %w

Error message

plugin(%s): newPlugin %w

What it means

Wrapping error in PluginModuleBuilder.Build: the plugin constructor newPlugin(settings.Settings) returned an error after successful lookup — i.e. the plugin itself rejected the settings passed from linters-settings.custom. The failure originates inside the plugin's own initialization code.

Source

Thrown at pkg/lint/lintersdb/builder_plugin_module.go:49

	}

	var linters []*linter.Config

	for name, settings := range cfg.Linters.Settings.Custom {
		if settings.Type != modulePluginType {
			continue
		}

		b.log.Infof("Loaded %s: %s", settings.Path, name)

		newPlugin, err := register.GetPlugin(name)
		if err != nil {
			return nil, fmt.Errorf("plugin(%s): %w", name, err)
		}

		p, err := newPlugin(settings.Settings)
		if err != nil {
			return nil, fmt.Errorf("plugin(%s): newPlugin %w", name, err)
		}

		analyzers, err := p.BuildAnalyzers()
		if err != nil {
			return nil, fmt.Errorf("plugin(%s): BuildAnalyzers %w", name, err)
		}

		customLinter := goanalysis.NewLinter(name, settings.Description, analyzers, nil)

		switch strings.ToLower(p.GetLoadMode()) {
		case register.LoadModeSyntax:
			customLinter = customLinter.WithLoadMode(goanalysis.LoadModeSyntax)
		case register.LoadModeTypesInfo:
			customLinter = customLinter.WithLoadMode(goanalysis.LoadModeTypesInfo)
		default:
			customLinter = customLinter.WithLoadMode(goanalysis.LoadModeTypesInfo)
		}

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Check the wrapped error from the plugin's constructor
  2. Validate the settings object passed under the custom linter's 'settings' key
  3. Consult the plugin's documentation for accepted settings
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/lint/lintersdb/builder_plugin_module.go:49 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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