grafana/k6 · error
csv Parser constructor takes at least one non-nil source arg
Error message
csv Parser constructor takes at least one non-nil source argument
What it means
Error "csv Parser constructor takes at least one non-nil source argument" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/experimental/csv/module.go:159
}
callback(func() error {
return resolve(fn())
})
}()
return promise, nil
}
// NewParser creates a new CSV parser instance.
func (mi *ModuleInstance) NewParser(call sobek.ConstructorCall) *sobek.Object {
rt := mi.vu.Runtime()
if mi.vu.State() != nil {
common.Throw(rt, errors.New("csv Parser constructor must be called in the init context"))
}
if len(call.Arguments) < 1 || sobek.IsUndefined(call.Argument(0)) {
common.Throw(rt, fmt.Errorf("csv Parser constructor takes at least one non-nil source argument"))
}
fileArg := call.Argument(0)
if common.IsNullish(fileArg) {
common.Throw(rt, fmt.Errorf("csv Parser constructor takes at least one non-nil source argument"))
}
// 1. Make sure the Sobek object is a fs.File (Sobek operation)
var file fs.File
if err := mi.vu.Runtime().ExportTo(fileArg, &file); err != nil {
common.Throw(
mi.vu.Runtime(),
fmt.Errorf("first argument expected to be a fs.File instance, got %T instead", call.Argument(0)),
)
}
options := newDefaultParserOptions()
if len(call.Arguments) == 2 && !sobek.IsUndefined(call.Argument(1)) {View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/experimental/csv/module.go:159 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/d23f8cbfb448ff53.
Report an issue: GitHub.