{"record":{"id":"faf44bf3c8abae4a","repo":"grafana/k6","slug":"unknown-event-type-s","errorCode":null,"errorMessage":"unknown event type: %s","messagePattern":"unknown event type: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/websockets/listeners.go","lineNumber":99,"sourceCode":"\tcase events.ERROR:\n\t\treturn l.error\n\tcase events.CLOSE:\n\t\treturn l.close\n\tcase events.PING:\n\t\treturn l.ping\n\tcase events.PONG:\n\t\treturn l.pong\n\tdefault:\n\t\treturn nil\n\t}\n}\n\n// add adds a listener to the listeners\nfunc (l *eventListeners) add(t string, f func(sobek.Value) (sobek.Value, error)) error {\n\tlist := l.getType(t)\n\n\tif list == nil {\n\t\treturn fmt.Errorf(\"unknown event type: %s\", t)\n\t}\n\n\tlist.add(f)\n\n\treturn nil\n}\n\n// all returns all possible listeners for a certain event type or an empty array\nfunc (l *eventListeners) all(t string) []func(sobek.Value) (sobek.Value, error) {\n\tlist := l.getType(t)\n\n\tif list == nil {\n\t\treturn []func(sobek.Value) (sobek.Value, error){}\n\t}\n\n\treturn list.all()\n}\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/websockets/listeners.go#L81-L117","documentation":"Returned by the WebSocket eventListeners.add helper when the event name has no registered listener list — getType returned nil for the given type string. The dispatcher only knows the open/message/error/close/ping/pong events; subscribing to any other event name (typos included) hits this guard. Surfaces to the script as an error from ws.on()/addEventListener.","triggerScenarios":"Thrown at internal/js/modules/k6/websockets/listeners.go:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported event names: 'open', 'message', 'error', 'close', 'ping', 'pong'","Check for typos and case — event names are lowercase"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}