{"record":{"id":"2366fbb605d0cc11","repo":"muesli/duf","slug":"unknown-style-option-s","errorCode":null,"errorMessage":"unknown style option: %s","messagePattern":"unknown style option: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":99,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ti = append(i, col)\n\t}\n\n\treturn i, nil\n}\n\n// parseStyle converts user-provided style option into a table.Style.\nfunc parseStyle(styleOpt string) (table.Style, error) {\n\tswitch styleOpt {\n\tcase \"unicode\":\n\t\treturn table.StyleRounded, nil\n\tcase \"ascii\":\n\t\treturn table.StyleDefault, nil\n\tdefault:\n\t\treturn table.Style{}, fmt.Errorf(\"unknown style option: %s\", styleOpt)\n\t}\n}\n\n// parseCommaSeparatedValues parses comma separated string into a map.\nfunc parseCommaSeparatedValues(values string) map[string]struct{} {\n\tm := make(map[string]struct{})\n\tfor _, v := range strings.Split(values, \",\") {\n\t\tv = strings.TrimSpace(v)\n\t\tif len(v) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tv = strings.ToLower(v)\n\t\tm[v] = struct{}{}\n\t}\n\treturn m\n}\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/muesli/duf/blob/4636deb4a7b707a9f04c602db033f9837e50b3f6/main.go#L81-L117","documentation":"parseStyle maps the --style CLI option to a tablewriter style. Only \"unicode\" (table.StyleRounded) and \"ascii\" (table.StyleDefault) are accepted; any other value returns \"unknown style option: %s\". It is a strict enum validation of a user-supplied flag.","triggerScenarios":"Calling the binary with --style set to anything other than \"unicode\" or \"ascii\", e.g. --style rounded, --style fancy, --style UNICODE (case-sensitive).","commonSituations":"Users guess at style names, copy a style name from another table library, or capitalize the value expecting case-insensitive handling.","solutions":["Run with --style unicode or --style ascii exactly as lowercase.","Check the tool's help output for the accepted style values.","If you control the code, normalize input with strings.ToLower before the switch and/or add the desired style as a new case."],"exampleFix":"// before\nswitch styleOpt {\ncase \"unicode\": return table.StyleRounded, nil\ncase \"ascii\": return table.StyleDefault, nil\n}\n// after\nswitch strings.ToLower(styleOpt) {\ncase \"unicode\", \"rounded\": return table.StyleRounded, nil\ncase \"ascii\", \"default\": return table.StyleDefault, nil\n}","handlingStrategy":"validation","validationCode":"validStyles := map[string]bool{\"unicode\": true, \"ascii\": true}\nif !validStyles[style] {\n\treturn fmt.Errorf(\"style must be unicode or ascii, got %q\", style)\n}","typeGuard":null,"tryCatchPattern":"style, err := parseStyle(styleOpt)\nif err != nil {\n\tfmt.Fprintln(os.Stderr, err)\n\tos.Exit(1)\n}","preventionTips":["Only pass unicode or ascii (lowercase) as --style.","Normalize with strings.ToLower before validating.","Check --help for accepted values."],"tags":["go","cli","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"4636deb4a7b707a9f04c602db033f9837e50b3f6","analyzedAt":"2026-09-06T02:31:58.576Z","contentChangedAt":"2026-09-06T02:31:58.576Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}