derailed/k9s · warning
invalid file name %s
Error message
invalid file name %s
What it means
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.
Source
Thrown at internal/render/benchmark.go:117
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(), "_")
if len(tokens) < 2 {
return fmt.Errorf("invalid file name %s", f.Name())
}
row[0] = tokens[0]
row[1] = tokens[1]
row[7] = f.Name()
row[9] = ToAge(metav1.Time{Time: f.ModTime()})
return nil
}
func (b Benchmark) augmentRow(fields model1.Fields, data string) {
if data == "" {
return
}
col := 2
fields[col] = "pass"
mf := toastRx.FindAllStringSubmatch(data, 1)
if len(mf) > 0 {View on GitHub (pinned to 2d3ccc6ba2)
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
Example fix
# before mv bench1.txt nginx_run1.txt # after: file 'nginx_run1.txt' -> container=nginx, command=run1
Defensive patterns
Strategy: validation
Validate before calling
func validBenchFileName(name string) bool {
return strings.Count(name, "_") >= 1
} Try / catch
On 'invalid file name' from initRow, skip the file and log it as foreign to the bench directory rather than aborting the row batch.
Prevention
- 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
When it happens
Trigger: 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.
Common situations: Users dropping custom files into the bench directory; scripts writing results with their own naming scheme; renames that strip the underscore.
Related errors
- unable to load bench file %s
- no dir in context
- failed benchmark
- you must select a reachable service
- expecting screendumper, but got %T
AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15).
Data as JSON: /api/errors/a039f05e07902eba.
Report an issue: GitHub.