grafana/k6 · error

unable to define %s property; reason: %w

Error message

unable to define %s property; reason: %w

What it means

Raised by setDefaultPrototypePropertyOf when sobek's DefineDataProperty fails while defining a method with standard Web IDL descriptor flags (writable, enumerable, configurable) on a stream object. An internal runtime failure, not user-input validation.

Source

Thrown at internal/js/modules/k6/experimental/streams/sobek.go:213

	)
	if err != nil {
		return fmt.Errorf("unable to define %s read-only property on %s object; reason: %w", propName, objName, err)
	}

	return nil
}

// setDefaultPrototypePropertyOf sets a property with the default Web IDL prototype method
// descriptors: writable, configurable, and enumerable.
func setDefaultPrototypePropertyOf(obj *sobek.Object, propName string, propValue sobek.Value) error {
	err := obj.DefineDataProperty(propName,
		propValue,
		sobek.FLAG_TRUE,
		sobek.FLAG_TRUE,
		sobek.FLAG_TRUE,
	)
	if err != nil {
		return fmt.Errorf("unable to define %s property; reason: %w", propName, err)
	}

	return nil
}

func hasOwnProperty(obj *sobek.Object, propName string) bool {
	return slices.Contains(obj.GetOwnPropertyNames(), propName)
}

// isObject determines whether the given [sobek.Value] is a [sobek.Object] or not.
func isObject(val sobek.Value) bool {
	return val != nil && val.ExportType() != nil && val.ExportType().Kind() == reflect.Map
}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Treat as an internal k6/sobek bug; report the triggering script
  2. Avoid replacing prototype methods of stream objects in user code
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/experimental/streams/sobek.go:213 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/4f6aea9a0a48278e. Report an issue: GitHub.