{"record":{"id":"8899794e59d3fec0","repo":"golangci/golangci-lint","slug":"failed-to-create-meta-formatter-w-889979","errorCode":null,"errorMessage":"failed to create meta-formatter: %w","messagePattern":"failed to create meta-formatter: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/lint/runner.go","lineNumber":78,"sourceCode":"\t}\n\n\tswitch len(enabledLinters) {\n\tcase 0:\n\t\treturn nil, errors.New(\"no linters enabled\")\n\tcase 1:\n\t\tif _, ok := enabledLinters[\"typecheck\"]; ok {\n\t\t\treturn nil, errors.New(\"no linters enabled\")\n\t\t}\n\t}\n\n\tformattersCfg := &config.Formatters{\n\t\tEnable:   enabledFormatters,\n\t\tSettings: cfg.Linters.Settings.FormatterSettings,\n\t}\n\n\tmetaFormatter, err := goformatters.NewMetaFormatter(log, formattersCfg, &cfg.Run)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create meta-formatter: %w\", err)\n\t}\n\n\treturn &Runner{\n\t\tProcessors: []processors.Processor{\n\t\t\t// Must be the first processor.\n\t\t\tprocessors.NewPathAbsoluter(log),\n\n\t\t\tprocessors.NewCgo(goenv),\n\n\t\t\t// Must be after Cgo.\n\t\t\tprocessors.NewFilenameUnadjuster(lintCtx.Packages, log.Child(logutils.DebugKeyFilenameUnadjuster)),\n\n\t\t\t// Must be after FilenameUnadjuster.\n\t\t\tprocessors.NewInvalidIssue(log.Child(logutils.DebugKeyInvalidIssue)),\n\n\t\t\t// Must be after PathAbsoluter, Cgo, FilenameUnadjuster InvalidIssue.\n\t\t\tpathRelativity,\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/lint/runner.go#L60-L96","documentation":"NewRunner builds a MetaFormatter (goformatters.NewMetaFormatter) from the enabled formatter list and formatter settings. If the formatter set or its settings are invalid, construction fails and the error is wrapped as \"failed to create meta-formatter\", so the runner never starts.","triggerScenarios":"Enabled formatters (auto-detected from enabledLinters via goformatters.IsFormatter) that cannot be instantiated, or malformed `linters-settings.formatters` / formatter-specific settings (e.g. invalid gofmt options, bad revision for gci) passed via formattersCfg.","commonSituations":"Enabling formatters like gofmt/goimports/gci/gofumpt with incompatible or invalid settings blocks; new settings keys introduced in a golangci-lint version not recognized by the installed binary; typos in formatter settings.","solutions":["Read the wrapped %w cause — it identifies which formatter or setting failed","Validate settings under `linters-settings.formatters` against the docs for your golangci-lint version","Run `golangci-lint config verify` to catch schema issues in formatter settings","Remove/disable the failing formatter and re-add settings incrementally"],"exampleFix":"// before (.golangci.yml)\nlinters-settings:\n  formatters:\n    gci:\n      custom-sections: bogus\n// after\nlinters-settings:\n  formatters:\n    gci:\n      sections:\n        - standard\n        - default","handlingStrategy":"validation","validationCode":"// Validate formatter settings before running:\n// golangci-lint config verify\n// golangci-lint fmt --diff .   # run formatters standalone to see init/usage errors","typeGuard":null,"tryCatchPattern":"metaFormatter, err := goformatters.NewMetaFormatter(log, formattersCfg, &cfg.Run)\nif err != nil {\n    return fmt.Errorf(\"failed to create meta-formatter: %w\", err)\n}","preventionTips":["Keep formatter settings keys aligned with your golangci-lint version's docs","Enable only one canonical formatter per concern (gofmt OR gofumpt, not both)","Run `golangci-lint config verify` as a pre-commit/CI step","Change formatter settings one key at a time and re-run to isolate breakage"],"tags":["golangci-lint","formatters","configuration"],"backgroundTag":"formatter-init-failed","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}