grafana/k6 · error
failed to skip lines until line
Error message
failed to skip lines until line %d; reason: %w
What it means
Raised in NewReaderFrom when the fromLine option is set above 0 and the reader hits an error (usually io.EOF, meaning the file has fewer lines than requested) while skipping records to reach the starting line.
Solutions
- Lower fromLine to a line number that exists in the file
- Remove fromLine to start from the beginning
- Verify the file actually contains at least fromLine data rows
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/experimental/csv/reader.go:79 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/f2c0ef42c61490d0.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/experimental/csv/reader.go:79
if err != nil {
return nil, fmt.Errorf("failed to read the first line; reason: %w", err)
}
reader.columnNames = header
reader.currentLine.Add(1)
}
if options.SkipFirstLine && (!options.FromLine.Valid || options.FromLine.Int64 == 0) {
if _, err := csvParser.Read(); err != nil {
return nil, fmt.Errorf("failed to skip the first line; reason: %w", err)
}
reader.currentLine.Add(1)
}
if options.FromLine.Valid && options.FromLine.Int64 > 0 {
for reader.currentLine.Load() < options.FromLine.Int64 {
if _, err := csvParser.Read(); err != nil {
return nil, fmt.Errorf("failed to skip lines until line %d; reason: %w", options.FromLine.Int64, err)
}
reader.currentLine.Add(1)
}
}
return reader, nil
}
// The csv module's read must implement the RecordReader interface.
var _ data.RecordReader = (*Reader)(nil)
// Read reads a record from the CSV file.
//
// If the `header` option is enabled, it will return a map of the record.
// Otherwise, it will return the record as a slice of strings.
func (r *Reader) Read() (any, error) {
toLineSet := r.options.ToLine.Valid
View on GitHub (pinned to 01ffac6f24)