derailed/k9s · error

default value %q for number input %q is not a valid number

Error message

default value %q for number input %q is not a valid number

What it means

Thrown by Plugin.Validate() (internal/config/plugin.go:104-107) when validating a k9s plugin file. Every declared input of type "number" that has a non-empty `default` must parse via strconv.ParseFloat; an empty default is skipped earlier (plugin.go:91-93), so this fires only when a default was supplied but is not numeric.

Source

Thrown at internal/config/plugin.go:106

		}
		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),
	}
}

// Load K9s plugins.
func (p Plugins) Load(path string, loadExtra bool) error {
	var errs error

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Set the default to a plain decimal number as a quoted string, e.g. default: "8080"
  2. If no default is wanted, remove the `default` key entirely (empty defaults are skipped by validation)
  3. Check for letter/O vs digit/0 typos and remove units or punctuation from the value
  4. Lint the file: run k9s and read the load error, or validate YAML with a linter before launching

Example fix

# before
inputs:
  - name: port
    type: number
    default: "808O"
# after
inputs:
  - name: port
    type: number
    default: "8080"
Defensive patterns

Strategy: validation

Validate before calling

// Validate a plugin file's number inputs before k9s loads it.
func CheckPluginInputs(p config.Plugin) error {
	seen := map[string]struct{}{}
	for _, in := range p.Inputs {
		if _, ok := seen[in.Name]; ok {
			return fmt.Errorf("duplicate input %q", in.Name)
		}
		seen[in.Name] = struct{}{}
		if in.Default == "" {
			continue
		}
		if in.Type == "number" {
			if _, err := strconv.ParseFloat(in.Default, 64); err != nil {
				return fmt.Errorf("input %q: default %q not a number", in.Name, in.Default)
			}
		}
	}
	return nil
}

Prevention

When it happens

Trigger: A plugin YAML input with `type: number` and a non-numeric default string: "eighty", "8O80" (letter O typo), "8080px", "10,5" (comma decimal separator), or "0x10" (hex is rejected by ParseFloat). Scientific notation like "1e3" and "Inf"/"NaN" are accepted.

Common situations: Hand-edited $HOME/.config/k9s/plugins.yml or XDG k9s/plugins directory files; copy-pasted plugin examples localized to locales using comma decimals; upgrades of k9s that tightened input validation.

Related errors


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