{"record":{"id":"8b913f516ce13b4d","repo":"grafana/k6","slug":"the-asobjects-option-is-enabled-but-no-header-w","errorCode":null,"errorMessage":"the 'asObjects' option is enabled, but no header was found","messagePattern":"the 'asObjects' option is enabled, but no header was found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/csv/reader.go","lineNumber":113,"sourceCode":"func (r *Reader) Read() (any, error) {\n\ttoLineSet := r.options.ToLine.Valid\n\n\t// If the `toLine` option was set and we have reached it, we return EOF.\n\tif toLineSet && r.options.ToLine.Int64 > 0 && r.currentLine.Load() > r.options.ToLine.Int64 {\n\t\treturn nil, io.EOF\n\t}\n\n\trecord, err := r.csv.Read()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr.currentLine.Add(1)\n\n\t// If header option is enabled, return a map of the record.\n\tif r.options.AsObjects.Valid && r.options.AsObjects.Bool {\n\t\tif r.columnNames == nil {\n\t\t\treturn nil, fmt.Errorf(\"the 'asObjects' option is enabled, but no header was found\")\n\t\t}\n\n\t\tif len(record) != len(r.columnNames) {\n\t\t\treturn nil, fmt.Errorf(\"record length (%d) doesn't match header length (%d)\", len(record), len(r.columnNames))\n\t\t}\n\n\t\trecordMap := make(map[string]string)\n\t\tfor i, value := range record {\n\t\t\trecordMap[r.columnNames[i]] = value\n\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.","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/experimental/csv/reader.go#L95-L131","documentation":"Error \"the 'asObjects' option is enabled, but no header was found\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/csv/reader.go:113 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"}