grafana/k6 · error
first argument expected to be a fs.File instance, got %T ins
Error message
first argument expected to be a fs.File instance, got %T instead
What it means
Error "first argument expected to be a fs.File instance, got %T instead" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/experimental/csv/module.go:104
// options holds the parser's as provided by the user.
options options
// vu is the VU instance that owns this module instance.
vu modules.VU
}
// parseSharedArrayNamePrefix is the prefix used for the shared array names created by the Parse function.
const parseSharedArrayNamePrefix = "csv.parse."
// Parse parses the provided CSV file, and returns a promise that resolves to a shared array
// containing the parsed data.
func (mi *ModuleInstance) Parse(file sobek.Value, options sobek.Value) (*sobek.Promise, error) {
rt := mi.vu.Runtime()
// 1. Make sure the Sobek object is a fs.File (Sobek operation)
var fileObj fs.File
if err := mi.vu.Runtime().ExportTo(file, &fileObj); err != nil {
return nil, fmt.Errorf("first argument expected to be a fs.File instance, got %T instead", file)
}
parserOptions := newDefaultParserOptions()
if options != nil {
var err error
parserOptions, err = newParserOptionsFrom(options.ToObject(rt))
if err != nil {
return nil, fmt.Errorf("failed to interpret the provided Parser options; reason: %w", err)
}
}
r, err := NewReaderFrom(fileObj.ReadSeekStater, parserOptions)
if err != nil {
return nil, fmt.Errorf("failed to create a new parser; reason: %w", err)
}
underlyingSharedArrayName, err := buildSharedArrayName(fileObj, parserOptions)
if err != nil {View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/experimental/csv/module.go:104 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/bc539d526e1c645e.
Report an issue: GitHub.