grafana/k6 · error
the 'fromLine' option must be less than the 'toLine'…
Error message
the 'fromLine' option must be less than the 'toLine' option; got 'fromLine': %d, 'toLine': %d
What it means
Raised by validateOptions during NewReaderFrom: both fromLine and toLine are set but fromLine is not less than toLine, producing an empty or invalid reading window. The message prints both values.
Solutions
- Adjust fromLine to be strictly less than toLine
- Remove one of the bounds if only a start or end limit is needed
- Remember lines are zero-based when computing the range
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/experimental/csv/reader.go:158 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/c9ef186c30e327cc.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/experimental/csv/reader.go:158
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 nil
}
View on GitHub (pinned to 01ffac6f24)