derailed/k9s · error

default value %q for bool input %q must be "true" or "false"

Error message

default value %q for bool input %q must be "true" or "false"

What it means

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.

Source

Thrown at internal/config/plugin.go:102

	seen := make(map[string]struct{}, len(p.Inputs))
	for _, input := range p.Inputs {
		if _, ok := seen[input.Name]; ok {
			return fmt.Errorf("duplicate input name %q", input.Name)
		}
		seen[input.Name] = struct{}{}

		if input.Default == "" {
			continue
		}

		switch input.Type {
		case InputTypeDropdown:
			if !slices.Contains(input.Options, input.Default) {
				return fmt.Errorf("default value %q for input %q is not a valid option", input.Default, input.Name)
			}
		case InputTypeBool:
			if input.Default != "true" && input.Default != "false" {
				return fmt.Errorf("default value %q for bool input %q must be \"true\" or \"false\"", input.Default, input.Name)
			}
		case InputTypeNumber:
			if _, err := strconv.ParseFloat(input.Default, 64); err != nil {
				return fmt.Errorf("default value %q for number input %q is not a valid number", input.Default, input.Name)
			}
		}
	}

	return nil
}

// NewPlugins returns a new plugin.
func NewPlugins() Plugins {
	return Plugins{
		Plugins: make(map[string]Plugin),
	}
}

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Set the default to exactly "true" or "false" (quoted, lowercase)
  2. Or remove the default to skip validation and let the prompt start unchecked
  3. Check for YAML type coercion: default: true (bool) vs default: "true" (string) — the field is string-typed

Example fix

# before
inputs:
  - name: force
    type: bool
    default: "yes"
# (or unquoted: default: true -> unmarshals as bool)

# after
inputs:
  - name: force
    type: bool
    default: "true"
Defensive patterns

Strategy: validation

Validate before calling

func boolDefaultValid(p Plugin) error {
	for _, in := range p.Inputs {
		if in.Type == InputTypeBool && in.Default != "" &&
			in.Default != "true" && in.Default != "false" {
			return fmt.Errorf("input %s: bool default %q must be \"true\"/\"false\"", in.Name, in.Default)
		}
	}
	return nil
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15). Data as JSON: /api/errors/418cd41065d41fcc. Report an issue: GitHub.