{"record":{"id":"3abd0a76073fde7e","repo":"derailed/k9s","slug":"failed-benchmark","errorCode":null,"errorMessage":"failed benchmark","messagePattern":"failed benchmark","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/render/benchmark.go","lineNumber":97,"sourceCode":"\t}\n\tb.augmentRow(r.Fields, data)\n\tr.Fields[8] = AsStatus(b.diagnose(ns, r.Fields))\n\n\treturn nil\n}\n\n// Happy returns true if resource is happy, false otherwise.\nfunc (Benchmark) diagnose(ns string, ff model1.Fields) error {\n\tstatusCol := 3\n\tif !client.IsAllNamespaces(ns) {\n\t\tstatusCol--\n\t}\n\n\tif len(ff) < statusCol {\n\t\treturn nil\n\t}\n\tif ff[statusCol] != \"pass\" {\n\t\treturn errors.New(\"failed benchmark\")\n\t}\n\n\treturn nil\n}\n\n// ----------------------------------------------------------------------------\n// Helpers...\n\nfunc (Benchmark) readFile(file string) (string, error) {\n\tdata, err := os.ReadFile(file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(data), nil\n}\n\nfunc (Benchmark) initRow(row model1.Fields, f os.FileInfo) error {\n\ttokens := strings.Split(f.Name(), \"_\")","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/render/benchmark.go#L79-L115","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the benchmark for the failing resource to regenerate a passing record.","Inspect the stored result file to see the actual failure reason behind the status.","If ALL rows flag as failed after an upgrade, suspect a column-index mismatch and realign the renderer with the file schema."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before rendering, sanity-check the status column index vs the file schema\nstatusCol := 3\nif !client.IsAllNamespaces(ns) { statusCol-- }\nif len(ff) <= statusCol { /* skip diagnosis, row too short */ }","typeGuard":"func isPass(fields []string, col int) bool { return len(fields) > col && fields[col] == \"pass\" }","tryCatchPattern":null,"preventionTips":["Re-run benchmarks to refresh result files after remediation.","Keep benchmark column layouts stable or update the status index constant with them.","Read the stored result file for the true failure reason."],"tags":["go","kubernetes","benchmark","render","health-status"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}