{"record":{"id":"ee652767209f84fd","repo":"grafana/k6","slug":"unable-to-define-s-read-only-property-on-s-objec","errorCode":null,"errorMessage":"unable to define %s read-only property on %s object; reason: %w","messagePattern":"unable to define (.+?) read-only property on (.+?) object; reason: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/streams/sobek.go","lineNumber":197,"sourceCode":"\t}\n\n\tif value.ToFloat() < 0 || value.ToInteger() < 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n// setReadOnlyPropertyOf sets a read-only property on the given [sobek.Object].\nfunc setReadOnlyPropertyOf(obj *sobek.Object, objName, propName string, propValue sobek.Value) error {\n\terr := obj.DefineDataProperty(propName,\n\t\tpropValue,\n\t\tsobek.FLAG_FALSE,\n\t\tsobek.FLAG_FALSE,\n\t\tsobek.FLAG_TRUE,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to define %s read-only property on %s object; reason: %w\", propName, objName, err)\n\t}\n\n\treturn nil\n}\n\n// setDefaultPrototypePropertyOf sets a property with the default Web IDL prototype method\n// descriptors: writable, configurable, and enumerable.\nfunc setDefaultPrototypePropertyOf(obj *sobek.Object, propName string, propValue sobek.Value) error {\n\terr := obj.DefineDataProperty(propName,\n\t\tpropValue,\n\t\tsobek.FLAG_TRUE,\n\t\tsobek.FLAG_TRUE,\n\t\tsobek.FLAG_TRUE,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to define %s property; reason: %w\", propName, err)\n\t}\n","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/experimental/streams/sobek.go#L179-L215","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/streams/sobek.go:197 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This is an internal Web-streams API error; report it as a k6 bug with the script that triggered it","Avoid monkey-patching stream objects in the script, which can conflict with read-only property definitions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}