golangci/golangci-lint · error

field 'module' is required

Error message

field 'module' is required

What it means

Inside the per-plugin loop of `Configuration.Validate` (pkg/commands/internal/configuration.go:48), every plugin entry must have a non-blank `module` field — the Go module path of the plugin (e.g. `github.com/user/golangci-plugin`). This is the first per-plugin check, so a plugin entry with an empty `module` aborts validation before any other field is examined.

Source

Thrown at pkg/commands/internal/configuration.go:48

}

// Validate checks and clean the configuration.
func (c *Configuration) Validate() error {
	if strings.TrimSpace(c.Version) == "" {
		return errors.New("root field 'version' is required")
	}

	if strings.TrimSpace(c.Name) == "" {
		c.Name = defaultBinaryName
	}

	if len(c.Plugins) == 0 {
		return errors.New("no plugins defined")
	}

	for _, plugin := range c.Plugins {
		if strings.TrimSpace(plugin.Module) == "" {
			return errors.New("field 'module' is required")
		}

		if strings.TrimSpace(plugin.Import) == "" {
			plugin.Import = plugin.Module
		}

		if strings.TrimSpace(plugin.Path) == "" && strings.TrimSpace(plugin.Version) == "" {
			return errors.New("missing information: 'version' or 'path' should be provided")
		}

		if strings.TrimSpace(plugin.Path) != "" && strings.TrimSpace(plugin.Version) != "" {
			return errors.New("invalid configuration: 'version' and 'path' should not be provided at the same time")
		}

		if strings.TrimSpace(plugin.Path) == "" {
			continue
		}

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Add the `module` field with the plugin's Go module import path to the offending plugins entry
  2. Confirm each list item's indentation — every field of one plugin must be under the same `- ` item
  3. Check the plugin's README for its exact module path (module path and import can differ; import defaults to module if omitted)

Example fix

# before
plugins:
  - version: v1.0.0
# after
plugins:
  - module: github.com/me/my-plugin
    version: v1.0.0
Defensive patterns

Strategy: validation

Validate before calling

var raw struct {
	Plugins []struct {
		Module string `yaml:"module"`
	} `yaml:"plugins"`
}
_ = yaml.Unmarshal(data, &raw)
for i, p := range raw.Plugins {
	if strings.TrimSpace(p.Module) == "" {
		log.Fatalf("plugins[%d]: missing module", i)
	}
}

Prevention

When it happens

Trigger: A `plugins:` entry in `.custom-gcl.yml` missing the `module:` key, having `module: ""`, whitespace only, or the value placed under a misspelled key (e.g. `name:` or `modul:`) so it decodes as empty.

Common situations: Hand-writing a new plugin entry and forgetting the module path; copying a local-path plugin example that used `path` only and dropping the module line; YAML list items mis-indented so fields attach to the wrong entry.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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