grafana/k6 · error
the 'header' option cannot be enabled when 'fromLine' is…
Error message
the 'header' option cannot be enabled when 'fromLine' is set to a value greater than 0
What it means
Raised by validateOptions during NewReaderFrom: asObjects is combined with a fromLine greater than 0. The header must be the very first line, so starting further down the file is incompatible with object mapping.
Solutions
- Remove fromLine (or set it to 0) when asObjects is enabled
- Disable asObjects if you genuinely need to start reading past the first line
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/experimental/csv/reader.go:145 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/7baded1a66495b5f.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/experimental/csv/reader.go:145
return record, nil
}
// validateOptions validates the reader options and returns an error if any validation fails.
func validateOptions(options options) error {
var (
fromLineSet = options.FromLine.Valid
toLineSet = options.ToLine.Valid
skipFirstLineSet = options.SkipFirstLine
asObjectsEnabled = options.AsObjects.Valid && options.AsObjects.Bool
)
if asObjectsEnabled && skipFirstLineSet {
return fmt.Errorf("the 'header' option cannot be enabled when 'skipFirstLine' is true")
}
if asObjectsEnabled && fromLineSet && options.FromLine.Int64 > 0 {
return fmt.Errorf("the 'header' option cannot be enabled when 'fromLine' is set to a value greater than 0")
}
if fromLineSet && options.FromLine.Int64 < 0 {
return fmt.Errorf("the 'fromLine' option must be greater than or equal to 0; got %d", options.FromLine.Int64)
}
if toLineSet && options.ToLine.Int64 < 0 {
return fmt.Errorf("the 'toLine' option must be greater than or equal to 0; got %d", options.ToLine.Int64)
}
if fromLineSet && toLineSet && options.FromLine.Int64 >= options.ToLine.Int64 {
return fmt.Errorf(
"the 'fromLine' option must be less than the 'toLine' option; got 'fromLine': %d, 'toLine': %d",
options.FromLine.Int64, options.ToLine.Int64,
)
}
return nilView on GitHub (pinned to 01ffac6f24)