{"record":{"id":"e49f0fa9b3dde429","repo":"derailed/k9s","slug":"unable-to-load-bench-file-s","errorCode":null,"errorMessage":"unable to load bench file %s","messagePattern":"unable to load bench file (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/render/benchmark.go","lineNumber":72,"sourceCode":"\t\tmodel1.HeaderColumn{Name: \"REQ/S\", Attrs: model1.Attrs{Align: tview.AlignRight}},\n\t\tmodel1.HeaderColumn{Name: \"2XX\", Attrs: model1.Attrs{Align: tview.AlignRight}},\n\t\tmodel1.HeaderColumn{Name: \"4XX/5XX\", Attrs: model1.Attrs{Align: tview.AlignRight}},\n\t\tmodel1.HeaderColumn{Name: \"REPORT\"},\n\t\tmodel1.HeaderColumn{Name: \"VALID\", Attrs: model1.Attrs{Wide: true}},\n\t\tmodel1.HeaderColumn{Name: \"AGE\", Attrs: model1.Attrs{Time: true}},\n\t}\n}\n\n// Render renders a K8s resource to screen.\nfunc (b Benchmark) Render(o any, ns string, r *model1.Row) error {\n\tbench, ok := o.(BenchInfo)\n\tif !ok {\n\t\treturn fmt.Errorf(\"no benchmarks available %T\", o)\n\t}\n\n\tdata, err := b.readFile(bench.Path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to load bench file %s\", bench.Path)\n\t}\n\n\tr.ID = bench.Path\n\tr.Fields = make(model1.Fields, len(b.Header(ns)))\n\tif err := b.initRow(r.Fields, bench.File); err != nil {\n\t\treturn err\n\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--","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/render/benchmark.go#L54-L90","documentation":"Benchmark.Render reads the benchmark result file at BenchInfo.Path via os.ReadFile; any read failure (file deleted, moved, permission denied) is replaced by this error. Note the code drops the underlying cause by formatting the path with %s instead of wrapping err with %w, so the real reason (ENOENT vs EACCES) is invisible.","triggerScenarios":"The bench directory listing happened, then the file was removed before Render read it; benchDir config points elsewhere; file permissions changed; empty Path.","commonSituations":"Clearing the k9s cache (~/.cache/k9s or the configured benchDir) while the benchmark view is open; two k9s instances with different benchDir configs; backup/restore that skipped bench files.","solutions":["Re-run the benchmark (k9s bench on the pod) to regenerate the file","Verify the benchDir setting in k9s config points to the directory that actually holds the files","Check permissions on the file and directory for the user running k9s","Refresh/reopen the benchmark view to re-list the directory instead of using stale paths"],"exampleFix":"// before: stale path rendered after cache wipe\n// after: re-run the bench\n// k9s: select pod -> bench -> choose container/command, file is recreated under benchDir","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(bench.Path); err != nil {\n\t// skip row / re-run bench instead of rendering\n\treturn nil\n}","typeGuard":"func asBenchInfo(o any) (BenchInfo, bool) {\n\tb, ok := o.(BenchInfo)\n\treturn b, ok\n}","tryCatchPattern":"Wrap Benchmark.Render per-row: on error containing 'unable to load bench file', drop the row from the view and log the path; do not fail the whole table render.","preventionTips":["os.Stat bench files before rendering rows","Do not clear the benchDir cache while the bench view is open","Keep benchDir consistent across k9s configs on the same machine"],"tags":["benchmark","filesystem","io"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}