{"record":{"id":"d23f8cbfb448ff53","repo":"grafana/k6","slug":"csv-parser-constructor-takes-at-least-one-non-nil","errorCode":null,"errorMessage":"csv Parser constructor takes at least one non-nil source argument","messagePattern":"csv Parser constructor takes at least one non-nil source argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/csv/module.go","lineNumber":159,"sourceCode":"\t\t}\n\t\tcallback(func() error {\n\t\t\treturn resolve(fn())\n\t\t})\n\t}()\n\n\treturn promise, nil\n}\n\n// NewParser creates a new CSV parser instance.\nfunc (mi *ModuleInstance) NewParser(call sobek.ConstructorCall) *sobek.Object {\n\trt := mi.vu.Runtime()\n\n\tif mi.vu.State() != nil {\n\t\tcommon.Throw(rt, errors.New(\"csv Parser constructor must be called in the init context\"))\n\t}\n\n\tif len(call.Arguments) < 1 || sobek.IsUndefined(call.Argument(0)) {\n\t\tcommon.Throw(rt, fmt.Errorf(\"csv Parser constructor takes at least one non-nil source argument\"))\n\t}\n\n\tfileArg := call.Argument(0)\n\tif common.IsNullish(fileArg) {\n\t\tcommon.Throw(rt, fmt.Errorf(\"csv Parser constructor takes at least one non-nil source argument\"))\n\t}\n\n\t// 1. Make sure the Sobek object is a fs.File (Sobek operation)\n\tvar file fs.File\n\tif err := mi.vu.Runtime().ExportTo(fileArg, &file); err != nil {\n\t\tcommon.Throw(\n\t\t\tmi.vu.Runtime(),\n\t\t\tfmt.Errorf(\"first argument expected to be a fs.File instance, got %T instead\", call.Argument(0)),\n\t\t)\n\t}\n\n\toptions := newDefaultParserOptions()\n\tif len(call.Arguments) == 2 && !sobek.IsUndefined(call.Argument(1)) {","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/experimental/csv/module.go#L141-L177","documentation":"Error \"csv Parser constructor takes at least one non-nil source argument\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/csv/module.go:159 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"}