golangci/golangci-lint · error

enabled tag %q doesn't exist, see %s's documentation

Error message

enabled tag %q doesn't exist, see %s's documentation

What it means

gocritic settings let users enable whole tag groups (style, performance, diagnostic, experimental, opinionated). validateCheckerTags iterates settings.gocritic.enabled-tags and fails if a tag isn't a known gocritic check tag, pointing you to the linter documentation.

Source

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

			return errors.New("disable-all and disabled-tags options must not be combined")
		}

		if len(s.DisabledChecks) > 0 {
			return errors.New("disable-all and disabled-checks options must not be combined")
		}

		if len(s.EnabledTags) == 0 && len(s.EnabledChecks) == 0 {
			return errors.New("all checks were disabled, but no one check was enabled: at least one must be enabled")
		}
	}

	return nil
}

func (s *settingsWrapper) validateCheckerTags() error {
	for _, tag := range s.EnabledTags {
		if !s.allChecksByTag.has(tag) {
			return fmt.Errorf("enabled tag %q doesn't exist, see %s's documentation", tag, linterName)
		}
	}

	for _, tag := range s.DisabledTags {
		if !s.allChecksByTag.has(tag) {
			return fmt.Errorf("disabled tag %q doesn't exist, see %s's documentation", tag, linterName)
		}
	}

	return nil
}

func (s *settingsWrapper) validateCheckerNames() error {
	for _, check := range s.EnabledChecks {
		if !s.allChecks.has(check) {
			return fmt.Errorf("enabled check %q doesn't exist, see %s's documentation", check, linterName)
		}
	}

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Use one of the valid tags: diagnostic, style, performance, experimental, opinionated
  2. Fix abbreviations/typos (perf -> performance)
  3. Remove the invalid tag from enabled-tags
  4. Check the gocritic documentation linked in the error for the current tag list

Example fix

# before
linters-settings:
  gocritic:
    enabled-tags:
      - perf
# after
linters-settings:
  gocritic:
    enabled-tags:
      - performance
Defensive patterns

Strategy: validation

Validate before calling

validTags := map[string]bool{"diagnostic": true, "style": true, "performance": true, "experimental": true, "opinionated": true}
for _, tag := range cfg.Gocritic.EnabledTags {
    if !validTags[tag] {
        return fmt.Errorf("invalid gocritic enabled-tag %q; allowed: diagnostic|style|performance|experimental|opinionated", tag)
    }
}

Try / catch

if err := golangci.Run(); err != nil {
    if strings.Contains(err.Error(), "doesn't exist, see") && strings.Contains(err.Error(), "documentation") {
        fmt.Fprintln(os.Stderr, "fix gocritic enabled-tags/disabled-tags to documented gocritic tags")
        os.Exit(1)
    }
    return err
}

Prevention

When it happens

Trigger: enabled-tags contains a value not in gocritic's tag set — e.g. 'perf' instead of 'performance', 'bugs' instead of 'diagnostic', or a custom tag — when validateCheckerTags runs during gocritic settings build.

Common situations: Guessing tag names (perf/bug/style-ish variants), copying enabled-tags from other linters (staticcheck-style tags like 'SA'), gocritic adding/renaming tags across versions.

Related errors


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