{"record":{"id":"db061050fc70b34e","repo":"grafana/k6","slug":"the-header-option-cannot-be-enabled-when-skipfi","errorCode":null,"errorMessage":"the 'header' option cannot be enabled when 'skipFirstLine' is true","messagePattern":"the 'header' option cannot be enabled when 'skipFirstLine' is true","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/csv/reader.go","lineNumber":141,"sourceCode":"\t\t}\n\n\t\treturn recordMap, nil\n\t}\n\n\treturn record, nil\n}\n\n// validateOptions validates the reader options and returns an error if any validation fails.\nfunc validateOptions(options options) error {\n\tvar (\n\t\tfromLineSet      = options.FromLine.Valid\n\t\ttoLineSet        = options.ToLine.Valid\n\t\tskipFirstLineSet = options.SkipFirstLine\n\t\tasObjectsEnabled = options.AsObjects.Valid && options.AsObjects.Bool\n\t)\n\n\tif asObjectsEnabled && skipFirstLineSet {\n\t\treturn fmt.Errorf(\"the 'header' option cannot be enabled when 'skipFirstLine' is true\")\n\t}\n\n\tif asObjectsEnabled && fromLineSet && options.FromLine.Int64 > 0 {\n\t\treturn fmt.Errorf(\"the 'header' option cannot be enabled when 'fromLine' is set to a value greater than 0\")\n\t}\n\n\tif fromLineSet && options.FromLine.Int64 < 0 {\n\t\treturn fmt.Errorf(\"the 'fromLine' option must be greater than or equal to 0; got %d\", options.FromLine.Int64)\n\t}\n\n\tif toLineSet && options.ToLine.Int64 < 0 {\n\t\treturn fmt.Errorf(\"the 'toLine' option must be greater than or equal to 0; got %d\", options.ToLine.Int64)\n\t}\n\n\tif fromLineSet && toLineSet && options.FromLine.Int64 >= options.ToLine.Int64 {\n\t\treturn fmt.Errorf(\n\t\t\t\"the 'fromLine' option must be less than the 'toLine' option; got 'fromLine': %d, 'toLine': %d\",\n\t\t\toptions.FromLine.Int64, options.ToLine.Int64,","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/experimental/csv/reader.go#L123-L159","documentation":"Raised by validateOptions during NewReaderFrom: the asObjects (header) option and skipFirstLine are mutually exclusive, because skipping the first line would discard the header needed to build row objects.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/csv/reader.go:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove skipFirstLine when using asObjects — the header is consumed automatically","Drop asObjects and keep skipFirstLine if the first line is not a header"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}