derailed/k9s · error

plugin %q validation failed for %s: %w

Error message

plugin %q validation failed for %s: %w

What it means

For the plugins-map shape, k9s validates each plugin in the map with Plugin.Validate() (internal/config/plugin.go:185-190). This error names the specific plugin key %q and the file path, wrapping the semantic failure.

Source

Thrown at internal/config/plugin.go:188

	switch scheme {
	case json.PluginSchema:
		var o Plugin
		if err := yaml.Unmarshal(bb, &o); err != nil {
			return fmt.Errorf("plugin unmarshal failed for %s: %w", path, err)
		}
		if err := o.Validate(); err != nil {
			return fmt.Errorf("plugin validation failed for %s: %w", path, err)
		}
		p.Plugins[strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))] = o
	case json.PluginsSchema:
		var oo Plugins
		if err := yaml.Unmarshal(bb, &oo); err != nil {
			return fmt.Errorf("plugin unmarshal failed for %s: %w", path, err)
		}
		for k := range oo.Plugins {
			plug := oo.Plugins[k]
			if err := plug.Validate(); err != nil {
				return fmt.Errorf("plugin %q validation failed for %s: %w", k, path, err)
			}
			p.Plugins[k] = plug
		}
	case json.PluginMultiSchema:
		var oo plugins
		if err := yaml.Unmarshal(bb, &oo); err != nil {
			return fmt.Errorf("plugin unmarshal failed for %s: %w", path, err)
		}
		for k := range oo {
			plug := oo[k]
			if err := plug.Validate(); err != nil {
				return fmt.Errorf("plugin %q validation failed for %s: %w", k, path, err)
			}
			p.Plugins[k] = plug
		}
	}

	return nil

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Read the message: the first verb (%q) is the plugin key, the %w tail is the exact rule broken
  2. Fix that one entry's inputs (unique names, defaults matching type rules)
  3. Re-run k9s; remaining bad entries will surface one at a time since load fails fast per file
Defensive patterns

Strategy: validation

Validate before calling

// Validate every map entry and report all failures at once, unlike k9s's fail-fast load.
func LintAllEntries(path string) []error {
	b, _ := os.ReadFile(path)
	var ps config.Plugins
	_ = yaml.Unmarshal(b, &ps)
	var errs []error
	for k, p := range ps.Plugins {
		if err := p.Validate(); err != nil { errs = append(errs, fmt.Errorf("%q: %w", k, err)) }
	}
	return errs
}

Prevention

When it happens

Trigger: Any Plugin.Validate failure (duplicate input name, bad dropdown/bool/number default - see errors 100/103) inside one entry of a `plugins:` map. The %q in the message identifies which map key is at fault, which error 103 does not provide.

Common situations: Large multi-plugin files where one entry has a bad default; entries copied from different sources with inconsistent input definitions.

Related errors


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