{"record":{"id":"4f6aea9a0a48278e","repo":"grafana/k6","slug":"unable-to-define-s-property-reason-w","errorCode":null,"errorMessage":"unable to define %s property; reason: %w","messagePattern":"unable to define (.+?) property; reason: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/experimental/streams/sobek.go","lineNumber":213,"sourceCode":"\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\n\treturn nil\n}\n\nfunc hasOwnProperty(obj *sobek.Object, propName string) bool {\n\treturn slices.Contains(obj.GetOwnPropertyNames(), propName)\n}\n\n// isObject determines whether the given [sobek.Value] is a [sobek.Object] or not.\nfunc isObject(val sobek.Value) bool {\n\treturn val != nil && val.ExportType() != nil && val.ExportType().Kind() == reflect.Map\n}\n","sourceCodeStart":195,"sourceCodeEnd":227,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/experimental/streams/sobek.go#L195-L227","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/experimental/streams/sobek.go:213 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat as an internal k6/sobek bug; report the triggering script","Avoid replacing prototype methods of stream objects in user code"],"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-14T00:17:10.932Z"}