{"record":{"id":"5671f0f0afc845a1","repo":"golangci/golangci-lint","slug":"unknown-type-s","errorCode":null,"errorMessage":"unknown type %s","messagePattern":"unknown type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/goconst/goconst.go","lineNumber":150,"sourceCode":"\t\treturn goconstAPI.Assignment, nil\n\n\tcase \"binary\":\n\t\treturn goconstAPI.Binary, nil\n\n\tcase \"case\":\n\t\treturn goconstAPI.Case, nil\n\n\tcase \"return\":\n\t\treturn goconstAPI.Return, nil\n\n\tcase \"call\":\n\t\treturn goconstAPI.Call, nil\n\n\tcase \"compositelit\":\n\t\treturn goconstAPI.CompositeLit, nil\n\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unknown type %s\", v)\n\t}\n}\n","sourceCodeStart":132,"sourceCodeEnd":153,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/goconst/goconst.go#L132-L153","documentation":"goconst's toType maps user-facing string values (from config) to goconst API option types; an unrecognized string falls to the default branch and yields 'unknown type %s'. The config value for which option it applies to (e.g. match-constant vs number-minimum occurrences category or occurrence type) is not one of the accepted literals.","triggerScenarios":"runGoconst read a goconst setting (e.g. the type/occurrence-related option such as 'find-duplicates' or the string-vs-compositelit selector) whose value isn't 'string' equivalent, 'number', or 'compositelit', so the switch in toType hits default.","commonSituations":"Typo in .golangci.yml (e.g. 'compositeliteral', 'CompositLit', 'str'), copying an option name from a newer/older goconst version with renamed values, or YAML quoting introducing unexpected characters.","solutions":["Check the goconst settings documentation and use exact accepted values (e.g. 'compositelit', not 'compositeliteral')","Fix casing/typos — values are compared as raw strings","Remove the invalid option to fall back to defaults","Upgrade/downgrade golangci-lint if the valid value set changed between versions"],"exampleFix":"# before\nlinters-settings:\n  goconst:\n    ignore-type: compositeliteral\n# after\nlinters-settings:\n  goconst:\n    ignore-type: compositelit","handlingStrategy":"validation","validationCode":"validGoconstValues := map[string]bool{\"string\": true, \"number\": true, \"compositelit\": true}\nfor _, v := range goconstTypeValues {\n    if !validGoconstValues[strings.ToLower(v)] {\n        return fmt.Errorf(\"invalid goconst type value %q; allowed: string|number|compositelit\", v)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := golangci.Run(); err != nil {\n    if strings.Contains(err.Error(), \"unknown type\") {\n        fmt.Fprintln(os.Stderr, \"fix goconst setting value: must be one of the documented literals (e.g. compositelit)\")\n        os.Exit(1)\n    }\n    return err\n}","preventionTips":["Copy goconst option values from the official docs, not from memory","Keep values lowercase and exact (compositelit, not compositeliteral)","Lint the YAML config in CI with a schema check (e.g. golangci-lint config verify)"],"tags":["golangci-lint","goconst","configuration"],"backgroundTag":"invalid-enum-config-value","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}