golangci/golangci-lint · error
%s is not a linter, it cannot be enabled or disabled
Error message
%s is not a linter, it cannot be enabled or disabled
What it means
Loader.Load rejects 'typecheck' in linters.enable or linters.disable because typecheck is an internal analysis stage, not an enableable linter. This is common when migrating v1 configs, where typecheck could be listed.
Source
Thrown at pkg/config/loader.go:89
}
if l.mode == modeLinters {
l.applyStringSliceHack()
}
if l.cfg.Linters.Exclusions.Generated == "" {
l.cfg.Linters.Exclusions.Generated = GeneratedModeStrict
}
err = l.checkConfigurationVersion()
if err != nil {
return err
}
if !l.cfg.InternalCmdTest {
for _, n := range slices.Concat(l.cfg.Linters.Enable, l.cfg.Linters.Disable) {
if n == "typecheck" {
return fmt.Errorf("%s is not a linter, it cannot be enabled or disabled", n)
}
}
}
l.handleFormatters()
if opts.CheckDeprecation {
err = l.handleDeprecation()
if err != nil {
return err
}
l.handleFormatterDeprecations()
}
l.handleGoVersion()
err = goutil.CheckGoVersion(l.cfg.Run.Go)View on GitHub (pinned to ed7a235d2d)
Solutions
- Remove 'typecheck' from linters.enable and linters.disable in the config
- Remove typecheck from the -E/--enable CLI flags in scripts/CI
- Rely on the fact that typechecking always runs implicitly
Example fix
# before
linters:
enable:
- typecheck
- staticcheck
# after
linters:
enable:
- staticcheck Defensive patterns
Strategy: validation
Validate before calling
for _, n := range append(cfg.Linters.Enable, cfg.Linters.Disable...) {
if n == "typecheck" {
return errors.New("typecheck is internal; remove it from enable/disable")
}
} Try / catch
if err := loader.Load(ctx); err != nil {
if strings.Contains(err.Error(), "typecheck") {
log.Fatal("remove typecheck from linters config")
}
} Prevention
- Never add typecheck to -E/--enable flags or linters lists
- Strip legacy v1 entries when migrating
- Grep configs and CI scripts for 'typecheck' after upgrading
When it happens
Trigger: Config containing 'typecheck' under linters.enable or linters.disable, or the --enable/-E CLI flag passing typecheck (skipped only when InternalCmdTest is set).
Common situations: v1-to-v2 config migration leftovers; old CI scripts with golangci-lint run -E typecheck; copy-pasted deprecated config examples.
Related errors
- %s is a formatter
- at least %d of (text, source, path[-except], linters) should
- %s is not a formatter
- error in exclude rule #%d: %w
- invalid preset: %s
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/6355323267373355.
Report an issue: GitHub.