grafana/k6 · error
the 'asObjects' option is enabled, but no header was found
Error message
the 'asObjects' option is enabled, but no header was found
What it means
Error "the 'asObjects' option is enabled, but no header was found" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/experimental/csv/reader.go:113
func (r *Reader) Read() (any, error) {
toLineSet := r.options.ToLine.Valid
// If the `toLine` option was set and we have reached it, we return EOF.
if toLineSet && r.options.ToLine.Int64 > 0 && r.currentLine.Load() > r.options.ToLine.Int64 {
return nil, io.EOF
}
record, err := r.csv.Read()
if err != nil {
return nil, err
}
r.currentLine.Add(1)
// If header option is enabled, return a map of the record.
if r.options.AsObjects.Valid && r.options.AsObjects.Bool {
if r.columnNames == nil {
return nil, fmt.Errorf("the 'asObjects' option is enabled, but no header was found")
}
if len(record) != len(r.columnNames) {
return nil, fmt.Errorf("record length (%d) doesn't match header length (%d)", len(record), len(r.columnNames))
}
recordMap := make(map[string]string)
for i, value := range record {
recordMap[r.columnNames[i]] = value
}
return recordMap, nil
}
return record, nil
}
// validateOptions validates the reader options and returns an error if any validation fails.View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/experimental/csv/reader.go:113 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/8b913f516ce13b4d.
Report an issue: GitHub.