{"record":{"id":"e7a04449952c331f","repo":"helm/helm","slug":"invalid-color-mode-q-must-be-one-of-never-auto","errorCode":null,"errorMessage":"invalid color mode %q: must be one of: never, auto, always","messagePattern":"invalid color mode %q: must be one of: never, auto, always","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/root.go","lineNumber":198,"sourceCode":"\n\tlogSetup(settings.Debug)\n\n\t// newRootCmdWithConfig is only called from NewRootCmd. NewRootCmd sets up\n\t// NewConfiguration without a custom logger. So, the slog default is used. logSetup\n\t// can change the default logger to the one in the logger package. This happens for\n\t// the Helm client. This means the actionConfig logger is different from the slog\n\t// default logger. If they are different we sync the actionConfig logger to the slog\n\t// current default one.\n\tif actionConfig.Logger() != slog.Default() {\n\t\tactionConfig.SetLogger(slog.Default().Handler())\n\t}\n\n\t// Validate color mode setting\n\tswitch settings.ColorMode {\n\tcase \"never\", \"auto\", \"always\":\n\t\t// Valid color mode\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid color mode %q: must be one of: never, auto, always\", settings.ColorMode)\n\t}\n\n\t// Configure color output based on ColorMode setting\n\tconfigureColorOutput(settings)\n\n\t// Setup shell completion for the color flag\n\t_ = cmd.RegisterFlagCompletionFunc(\"color\", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\t\treturn []string{\"never\", \"auto\", \"always\"}, cobra.ShellCompDirectiveNoFileComp\n\t})\n\n\t// Setup shell completion for the colour flag\n\t_ = cmd.RegisterFlagCompletionFunc(\"colour\", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\t\treturn []string{\"never\", \"auto\", \"always\"}, cobra.ShellCompDirectiveNoFileComp\n\t})\n\n\t// Setup shell completion for the namespace flag\n\terr := cmd.RegisterFlagCompletionFunc(\"namespace\", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\t\tif client, err := actionConfig.KubernetesClientSet(); err == nil {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/helm/helm/blob/2a29f1770b62844b27197d2507377361d45ad7c0/pkg/cmd/root.go#L180-L216","documentation":"Returned during root command setup (pkg/cmd/root.go:198) when settings.ColorMode is not one of 'never', 'auto', 'always'. ColorMode is bound to both the --color and --colour flags (pkg/cli/environment.go:170-171) and initialized from the NO_COLOR/HELM_COLOR environment variables, where invalid HELM_COLOR values are silently ignored; the error therefore fires when an invalid value arrives via the flag itself or a settings/config source.","triggerScenarios":"Running any Helm command with '--color=yes', '--colour=1', or any value outside the allowed set; setting ColorMode programmatically on a cli.EnvSettings struct in SDK code; configs that copy a numeric color level (e.g. 'always 3' or '256color') into the flag.","commonSituations":"Porting scripts from tools that use 'yes/no', 'on/off', or 'true/false' color values; assuming the flag accepts a color count; wrapper scripts forwarding a TERM-derived value into --color.","solutions":["Use exactly one of: never, auto, or always (lowercase).","If the intent is to disable color in CI, prefer '--color never' or setting NO_COLOR=1.","In SDK code, set settings.ColorMode from a validated constant before building the command tree."],"exampleFix":"# before\nhelm list --color=yes\n\n# after\nhelm list --color=always   # or: never / auto","handlingStrategy":"validation","validationCode":"# bash: whitelist color modes before invoking helm\ncase \"${COLOR:-auto}\" in never|auto|always) ;; *) COLOR=auto ;; esac\nhelm list --color \"$COLOR\"\n\n# Go SDK:\nswitch settings.ColorMode {\ncase \"never\", \"auto\", \"always\":\ndefault:\n    settings.ColorMode = \"auto\"\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use NO_COLOR=1 to disable color instead of inventing flag values.","Never forward TERM-derived or numeric color levels into --color; the accepted set is exactly never|auto|always."],"tags":["helm","cli","color","flag-validation","configuration"],"backgroundTag":null,"analyzedSha":"2a29f1770b62844b27197d2507377361d45ad7c0","analyzedAt":"2026-08-15T22:02:47.490Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}