{"record":{"id":"5dbe69a3995803ff","repo":"golangci/golangci-lint","slug":"process-extra-words-w","errorCode":null,"errorMessage":"process extra words: %w","messagePattern":"process extra words: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/misspell/misspell.go","lineNumber":63,"sourceCode":"\treplacer := &misspell.Replacer{\n\t\tReplacements: misspell.DictMain,\n\t}\n\n\t// Figure out regional variations\n\tswitch strings.ToUpper(settings.Locale) {\n\tcase \"\":\n\t\t// nothing\n\tcase \"US\":\n\t\treplacer.AddRuleList(misspell.DictAmerican)\n\tcase \"UK\", \"GB\":\n\t\treplacer.AddRuleList(misspell.DictBritish)\n\tcase \"NZ\", \"AU\", \"CA\":\n\t\treturn nil, fmt.Errorf(\"unknown locale: %q\", settings.Locale)\n\t}\n\n\terr := appendExtraWords(replacer, settings.ExtraWords)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"process extra words: %w\", err)\n\t}\n\n\tif len(settings.IgnoreRules) != 0 {\n\t\treplacer.RemoveRule(settings.IgnoreRules)\n\t}\n\n\t// It can panic.\n\treplacer.Compile()\n\n\treturn replacer, nil\n}\n\nfunc runMisspellOnFile(pass *analysis.Pass, file *ast.File, replacer *misspell.Replacer, mode string) error {\n\tposition, isGoFile := goanalysis.GetGoFilePosition(pass, file)\n\tif !isGoFile {\n\t\treturn nil\n\t}\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/misspell/misspell.go#L45-L81","documentation":"When configuring misspell, golangci-lint merges user-supplied extra words (typo/correction pairs) into the replacer via appendExtraWords. If that helper fails — empty typo/correction fields or non-letter characters — the error is wrapped as \"process extra words\" and the linter constructor fails.","triggerScenarios":"A linters-settings.misspell.extra-words entry has an empty typo or correction, or contains non-letter characters (spaces, digits, punctuation, hyphens), causing appendExtraWords to return an error which runMisspell's setup wraps.","commonSituations":"Custom extra-words lists with blank YAML keys, copy-pasted entries with trailing spaces, or users trying to add multi-word phrases like \"cant -> cannot wait\" which contain a space.","solutions":["Inspect each extra-words entry: both typo and correction must be non-empty.","Remove non-letter characters (spaces, digits, hyphens, apostrophes) from typo and correction values.","Split multi-word phrases into single words or use a different mechanism; each field must be a single alphabetic word.","Validate your config with `golangci-lint config verify` before running the linter."],"exampleFix":"# before\nlinters-settings:\n  misspell:\n    extra-words:\n      - typo: \"\"\n        correction: \"cannot\"\n# after\nlinters-settings:\n  misspell:\n    extra-words:\n      - typo: \"cant\"\n        correction: \"cannot\"","handlingStrategy":"validation","validationCode":"for _, w := range cfg.Misspell.ExtraWords {\n    if w.Typo == \"\" || w.Correction == \"\" {\n        return errors.New(\"extra-words entries need non-empty typo and correction\")\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure every extra-words entry has both fields filled with single alphabetic words.","Validate config with `golangci-lint config verify` in CI.","Avoid generating extra-words entries from unvalidated external data."],"tags":["golang","linter","misspell","configuration"],"backgroundTag":"invalid-linter-config","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}