golangci/golangci-lint · error

checker %s config param %s doesn't exist: checker doesn't ha

Error message

checker %s config param %s doesn't exist: checker doesn't have params

What it means

gocritic's settings wrapper applies user config params (settings.gocritic.settings.<checker>) to each enabled checker. If a key targets a checker that has no parameters at all (info.Params is empty), setCheckerParams returns this error, telling you that checker simply accepts no config.

Source

Thrown at pkg/golinters/gocritic/gocritic_settings.go:210

	allLowerCasedParams map[string]config.GoCriticCheckSettings,
) error {
	params := allLowerCasedParams[strings.ToLower(info.Name)]
	if params == nil { // no config for this checker
		return nil
	}

	// To lowercase info param keys here because golangci-lint's config parser lowercases all strings.
	infoParams := normalizeMap(info.Params)
	for k, p := range params {
		v, ok := infoParams[k]
		if ok {
			v.Value = s.normalizeCheckerParamsValue(p)
			continue
		}

		// param `k` isn't supported
		if len(info.Params) == 0 {
			return fmt.Errorf("checker %s config param %s doesn't exist: checker doesn't have params",
				info.Name, k)
		}

		return fmt.Errorf("checker %s config param %s doesn't exist, all existing: %s",
			info.Name, k, slices.Sorted(maps.Keys(info.Params)))
	}

	return nil
}

func (s *settingsWrapper) debugChecksInitialState() {
	if !isDebug {
		return
	}

	debugf("All gocritic existing tags and checks:")

	for _, tag := range s.allTagsSorted {

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Remove the settings block for that checker — it accepts no parameters
  2. Verify parameterizable checkers (e.g. paramTypeCombine, hugeParam, rangeValCopy, truncateCmp) and move your settings to one of those
  3. Check the gocritic checker docs (go-critic.com) for which checkers have params
  4. Fix the checker key spelling if you meant a different, parameterized checker

Example fix

# before
linters-settings:
  gocritic:
    settings:
      nilValReturn:
        style: strict
# after (nilValReturn has no params) — remove the block
linters-settings:
  gocritic:
    settings: {}
Defensive patterns

Strategy: validation

Validate before calling

// Only add gocritic settings blocks for checkers known to accept params:
parameterless := map[string]bool{"nilValReturn": true, "sloppyLen": true /* verify per gocritic docs */}
for checker := range cfg.Gocritic.Settings {
    if parameterless[checker] {
        return fmt.Errorf("gocritic checker %q accepts no settings; remove the block", checker)
    }
}

Try / catch

if err := golangci.Run(); err != nil {
    if strings.Contains(err.Error(), "doesn't have params") {
        fmt.Fprintln(os.Stderr, "remove the gocritic.settings block for that checker — it takes no params")
        os.Exit(1)
    }
    return err
}

Prevention

When it happens

Trigger: A .golangci.yml gocritic.settings.<CheckerName> block (e.g. settings: {hugeParam: {...}} on a checker with no params) is applied in buildEnabledCheckers via setCheckerParams for a checker whose gocritic info has len(info.Params)==0.

Common situations: Assuming every gocritic checker is configurable; copying settings blocks for checkers that take none; misnamed checker keys landing on a parameterless checker.

Related errors


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