derailed/k9s · warning

failed benchmark

Error message

failed benchmark

What it means

Benchmark.diagnose is a row-health check for the benchmarks view: it reads the STATUS column (index 3 cluster-wide, 2 when namespace-scoped collapses a column) and returns this error whenever it is not 'pass'. The renderer uses it to flag failing rows; it is a status verdict, not an infrastructure fault.

Source

Thrown at internal/render/benchmark.go:97

	}
	b.augmentRow(r.Fields, data)
	r.Fields[8] = AsStatus(b.diagnose(ns, r.Fields))

	return nil
}

// Happy returns true if resource is happy, false otherwise.
func (Benchmark) diagnose(ns string, ff model1.Fields) error {
	statusCol := 3
	if !client.IsAllNamespaces(ns) {
		statusCol--
	}

	if len(ff) < statusCol {
		return nil
	}
	if ff[statusCol] != "pass" {
		return errors.New("failed benchmark")
	}

	return nil
}

// ----------------------------------------------------------------------------
// Helpers...

func (Benchmark) readFile(file string) (string, error) {
	data, err := os.ReadFile(file)
	if err != nil {
		return "", err
	}
	return string(data), nil
}

func (Benchmark) initRow(row model1.Fields, f os.FileInfo) error {
	tokens := strings.Split(f.Name(), "_")

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Re-run the benchmark for the failing resource to regenerate a passing record.
  2. Inspect the stored result file to see the actual failure reason behind the status.
  3. If ALL rows flag as failed after an upgrade, suspect a column-index mismatch and realign the renderer with the file schema.
Defensive patterns

Strategy: validation

Validate before calling

// before rendering, sanity-check the status column index vs the file schema
statusCol := 3
if !client.IsAllNamespaces(ns) { statusCol-- }
if len(ff) <= statusCol { /* skip diagnosis, row too short */ }

Type guard

func isPass(fields []string, col int) bool { return len(fields) > col && fields[col] == "pass" }

Prevention

When it happens

Trigger: Displaying the benchmarks list when stored benchmark results contain a row whose status is anything but pass (fail, error, warn); column layout assumptions break if the benchmark output schema changes so the status lands at a different index.

Common situations: Reviewing Popeye-style benchmark captures after a scan; stale result files in the bench dir shown with a newer render layout; customization of benchmark columns shifting the status index.

Related errors


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