grafana/k6 · error

failed to derive shared array name; reason

Error message

failed to derive shared array name; reason: %w

What it means

Raised in csv.Parse when buildSharedArrayName fails while deriving the unique SharedArray name from the file identity and parser options — '%w' carries the underlying error (commonly failure to stat/identify the file). The name must be unique per file+options combination because the parsed data is stored once in the shared-arrays registry; if it cannot be derived, the parsed array cannot be registered.

Solutions

  1. Verify the file handle refers to a real, stat-able file on disk
  2. Retry the parse if the file was temporarily unavailable
  3. Inspect the wrapped error for the stat/derivation failure detail
  4. Report as a bug if a valid opened file consistently fails to yield a name
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/experimental/csv/module.go:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/0e2e13e32bd76e08. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/experimental/csv/module.go:123

	}

	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 {
		return nil, fmt.Errorf("failed to derive shared array name; reason: %w", err)
	}

	callback := mi.vu.RegisterCallback()
	promise, resolve, reject := rt.NewPromise()

	go func() {
		// Because we rely on the data module to create the shared array, we need to
		// make sure that the data module is initialized before we can proceed, and that we don't instantiate
		// it multiple times.
		//
		// As such we hold a single instance of it in the RootModule, and we use it to create the shared array.
		fn, err := mi.dataModuleInstance.NewSharedArrayFrom(mi.vu.Runtime(), underlyingSharedArrayName, r)
		if err != nil {
			callback(func() error {
				return reject(rt.NewGoError(err))
			})
			return
		}

View on GitHub (pinned to 01ffac6f24)