{"record":{"id":"418cd41065d41fcc","repo":"derailed/k9s","slug":"default-value-q-for-bool-input-q-must-be-true","errorCode":null,"errorMessage":"default value %q for bool input %q must be \"true\" or \"false\"","messagePattern":"default value %q for bool input %q must be \"true\" or \"false\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/plugin.go","lineNumber":102,"sourceCode":"\tseen := make(map[string]struct{}, len(p.Inputs))\n\tfor _, input := range p.Inputs {\n\t\tif _, ok := seen[input.Name]; ok {\n\t\t\treturn fmt.Errorf(\"duplicate input name %q\", input.Name)\n\t\t}\n\t\tseen[input.Name] = struct{}{}\n\n\t\tif input.Default == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch input.Type {\n\t\tcase InputTypeDropdown:\n\t\t\tif !slices.Contains(input.Options, input.Default) {\n\t\t\t\treturn fmt.Errorf(\"default value %q for input %q is not a valid option\", input.Default, input.Name)\n\t\t\t}\n\t\tcase InputTypeBool:\n\t\t\tif input.Default != \"true\" && input.Default != \"false\" {\n\t\t\t\treturn fmt.Errorf(\"default value %q for bool input %q must be \\\"true\\\" or \\\"false\\\"\", input.Default, input.Name)\n\t\t\t}\n\t\tcase InputTypeNumber:\n\t\t\tif _, err := strconv.ParseFloat(input.Default, 64); err != nil {\n\t\t\t\treturn fmt.Errorf(\"default value %q for number input %q is not a valid number\", input.Default, input.Name)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// NewPlugins returns a new plugin.\nfunc NewPlugins() Plugins {\n\treturn Plugins{\n\t\tPlugins: make(map[string]Plugin),\n\t}\n}\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/config/plugin.go#L84-L120","documentation":"Returned by Plugin.Validate (internal/config/plugin.go:102) when a bool-typed input declares a default other than the exact lowercase strings \"true\" or \"false\". Bool input defaults are compared as strings, so \"True\", \"1\", \"yes\", or a YAML unquoted true (bool, not string) all fail. Like other Plugin.Validate failures it aborts loading of the whole plugin file.","triggerScenarios":"inputs: [{name: force, type: bool, default: \"yes\"}] or default: True (capitalized) or an unquoted YAML default: true which unmarshals as a boolean while the field is a string; any variant not exactly true/false.","commonSituations":"Porting prompts from other tools that accept 1/0 or yes/no; editors auto-capitalizing; forgetting quotes in YAML where the schema expects a string.","solutions":["Set the default to exactly \"true\" or \"false\" (quoted, lowercase)","Or remove the default to skip validation and let the prompt start unchecked","Check for YAML type coercion: default: true (bool) vs default: \"true\" (string) — the field is string-typed"],"exampleFix":"# before\ninputs:\n  - name: force\n    type: bool\n    default: \"yes\"\n# (or unquoted: default: true -> unmarshals as bool)\n\n# after\ninputs:\n  - name: force\n    type: bool\n    default: \"true\"","handlingStrategy":"validation","validationCode":"func boolDefaultValid(p Plugin) error {\n\tfor _, in := range p.Inputs {\n\t\tif in.Type == InputTypeBool && in.Default != \"\" &&\n\t\t\tin.Default != \"true\" && in.Default != \"false\" {\n\t\t\treturn fmt.Errorf(\"input %s: bool default %q must be \\\"true\\\"/\\\"false\\\"\", in.Name, in.Default)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote string-typed defaults in plugin YAML: default: \"true\", not default: true","Use only lowercase true/false — True/1/yes are rejected","If no preselection is wanted, omit default entirely (empty default skips validation)"],"tags":["k9s","plugins","validation","bool","yaml","config"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}