grafana/k6 · error

unable to define %s read-only property on %s object; reason:

Error message

unable to define %s read-only property on %s object; reason: %w

What it means

Raised by setReadOnlyPropertyOf when sobek's DefineDataProperty fails while attaching a non-writable, non-enumerable, configurable property (e.g. desiredSize on a CountQueuingStrategy or controller/reader objects). It signals a runtime-level object definition failure, not a user-data problem.

Source

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

	}

	if value.ToFloat() < 0 || value.ToInteger() < 0 {
		return false
	}

	return true
}

// setReadOnlyPropertyOf sets a read-only property on the given [sobek.Object].
func setReadOnlyPropertyOf(obj *sobek.Object, objName, propName string, propValue sobek.Value) error {
	err := obj.DefineDataProperty(propName,
		propValue,
		sobek.FLAG_FALSE,
		sobek.FLAG_FALSE,
		sobek.FLAG_TRUE,
	)
	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)
	}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. This is an internal Web-streams API error; report it as a k6 bug with the script that triggered it
  2. Avoid monkey-patching stream objects in the script, which can conflict with read-only property definitions
Defensive patterns

Strategy: try-catch

When it happens

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