{"record":{"id":"a039f05e07902eba","repo":"derailed/k9s","slug":"invalid-file-name-s","errorCode":null,"errorMessage":"invalid file name %s","messagePattern":"invalid file name (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/render/benchmark.go","lineNumber":117,"sourceCode":"\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(), \"_\")\n\tif len(tokens) < 2 {\n\t\treturn fmt.Errorf(\"invalid file name %s\", f.Name())\n\t}\n\trow[0] = tokens[0]\n\trow[1] = tokens[1]\n\trow[7] = f.Name()\n\trow[9] = ToAge(metav1.Time{Time: f.ModTime()})\n\n\treturn nil\n}\n\nfunc (b Benchmark) augmentRow(fields model1.Fields, data string) {\n\tif data == \"\" {\n\t\treturn\n\t}\n\n\tcol := 2\n\tfields[col] = \"pass\"\n\tmf := toastRx.FindAllStringSubmatch(data, 1)\n\tif len(mf) > 0 {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/render/benchmark.go#L99-L135","documentation":"Benchmark.initRow splits the bench file base name on '_' and requires at least 2 tokens: token 0 becomes the container column, token 1 the command column. A file with no underscore cannot populate the row schema and is rejected.","triggerScenarios":"A bench file manually created or renamed without '_', e.g. 'bench1.txt' or 'run.log'; k9s-generated names like '<container>_<command>_<ts>.txt' always pass.","commonSituations":"Users dropping custom files into the bench directory; scripts writing results with their own naming scheme; renames that strip the underscore.","solutions":["Rename the file to include at least one underscore: 'nginx_run1.txt' style, i.e. <container>_<label>[_<timestamp>]","Only let k9s create bench files via the bench command so naming stays canonical","Remove foreign files from the bench directory"],"exampleFix":"# before\nmv bench1.txt nginx_run1.txt\n# after: file 'nginx_run1.txt' -> container=nginx, command=run1","handlingStrategy":"validation","validationCode":"func validBenchFileName(name string) bool {\n\treturn strings.Count(name, \"_\") >= 1\n}","typeGuard":null,"tryCatchPattern":"On 'invalid file name' from initRow, skip the file and log it as foreign to the bench directory rather than aborting the row batch.","preventionTips":["Let k9s create bench files so naming stays '<container>_<command>[_<ts>]'","Keep foreign files out of the bench directory","If scripting bench results, encode container and label as underscore-separated tokens"],"tags":["benchmark","filesystem","naming"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}