golangci/golangci-lint · error

checker %s config param %s doesn't exist, all existing: %s

Error message

checker %s config param %s doesn't exist, all existing: %s

What it means

Same path as [187] but for checkers that DO have parameters: the configured key k is not among info.Params, so setCheckerParams rejects it and helpfully lists all valid parameter names for that checker. It is a typo/misnamed-parameter error in gocritic settings.

Source

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

		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 {
		debugChecksListf(s.allChecksByTag[tag], "  tag %q", tag)
	}
}

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Use the 'all existing: [...]' list in the message to pick the correct parameter name
  2. Fix typos (e.g. 'sizeThreshold' vs 'sizeTreshold')
  3. Move the parameter to the checker that actually defines it
  4. Cross-check with gocritic documentation for the checker's parameter schema

Example fix

# before
linters-settings:
  gocritic:
    settings:
      rangeValCopy:
        sizeTreshold: 128
# after
linters-settings:
  gocritic:
    settings:
      rangeValCopy:
        sizeThreshold: 128
Defensive patterns

Strategy: validation

Validate before calling

// Validate gocritic setting keys against a known schema before running:
schema := map[string][]string{
    "rangeValCopy": {"sizeThreshold"},
    "hugeParam":    {"sizeThreshold"},
    "truncateCmp":  {},
}
for checker, keys := range cfg.Gocritic.Settings {
    allowed := schema[checker]
    for k := range keys {
        if !slices.Contains(allowed, k) {
            return fmt.Errorf("unknown gocritic param %q for checker %q; allowed: %v", k, checker, allowed)
        }
    }
}

Try / catch

if err := golangci.Run(); err != nil {
    if strings.Contains(err.Error(), "all existing:") {
        fmt.Fprintln(os.Stderr, err) // message lists valid param names — fix the key accordingly
        os.Exit(1)
    }
    return err
}

Prevention

When it happens

Trigger: gocritic.settings.<Checker> contains a key not present in that checker's parameter set (e.g. hugeParam: {maxRange: 10} instead of rangeValCopy's sizeThreshold, or a misspelled 'sizeTreshold'), during buildEnabledCheckers.

Common situations: Typos in parameter names, mixing parameter names between checkers (sizeThreshold belongs to rangeValCopy/hugeParam variants), copying config from gocritic issues/docs of another version.

Related errors


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