{"record":{"id":"4e14e965580b7dfa","repo":"grafana/k6","slug":"failed-to-skip-the-first-line-reason-w","errorCode":null,"errorMessage":"failed to skip the first line; reason: %w","messagePattern":"failed to skip the first line; reason: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/csv/reader.go","lineNumber":70,"sourceCode":"\n\treader := &Reader{\n\t\tcsv:     csvParser,\n\t\toptions: options,\n\t}\n\n\tasObjectsEnabled := options.AsObjects.Valid && options.AsObjects.Bool\n\tif asObjectsEnabled {\n\t\theader, err := csvParser.Read()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read the first line; reason: %w\", err)\n\t\t}\n\t\treader.columnNames = header\n\t\treader.currentLine.Add(1)\n\t}\n\n\tif options.SkipFirstLine && (!options.FromLine.Valid || options.FromLine.Int64 == 0) {\n\t\tif _, err := csvParser.Read(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to skip the first line; reason: %w\", err)\n\t\t}\n\n\t\treader.currentLine.Add(1)\n\t}\n\n\tif options.FromLine.Valid && options.FromLine.Int64 > 0 {\n\t\tfor reader.currentLine.Load() < options.FromLine.Int64 {\n\t\t\tif _, err := csvParser.Read(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to skip lines until line %d; reason: %w\", options.FromLine.Int64, err)\n\t\t\t}\n\t\t\treader.currentLine.Add(1)\n\t\t}\n\t}\n\n\treturn reader, nil\n}\n\n// The csv module's read must implement the RecordReader interface.","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/experimental/csv/reader.go#L52-L88","documentation":"Error \"failed to skip the first line; reason: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/csv/reader.go:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}