grafana/k6 · error
couldn't get ArrayBuffer.isView as it isn't a function
Error message
couldn't get ArrayBuffer.isView as it isn't a function
What it means
Environment guard in the ArrayBufferView detection helper: isArrayBufferView looks up ArrayBuffer.isView in the current Sobek runtime and asserts it is callable. This sentinel error is returned when the property exists but is not a function (or is missing), meaning the script's global environment has been modified — a polyfill, mock, or accidental assignment has clobbered the built-in ArrayBuffer.isView.
Source
Thrown at internal/js/modules/k6/websockets/websockets.go:724
mtype: websocket.BinaryMessage,
data: b,
t: time.Now(),
}
}
func isArrayBufferView(rt *sobek.Runtime, v sobek.Value) (bool, error) {
var isView sobek.Callable
var ok bool
exc := rt.Try(func() {
isView, ok = sobek.AssertFunction(
rt.Get("ArrayBuffer").ToObject(rt).Get("isView"))
})
if exc != nil {
return false, exc
}
if !ok {
return false, fmt.Errorf("couldn't get ArrayBuffer.isView as it isn't a function")
}
boolValue, err := isView(nil, v)
if err != nil {
return false, err
}
return boolValue.ToBoolean(), nil
}
// Ping sends a ping message over the websocket.
func (w *webSocket) ping() {
w.assertStateOpen()
pingID := strconv.Itoa(w.sendPings.counter)
w.writeQueueCh <- message{
mtype: websocket.PingMessage,
data: []byte(pingID),View on GitHub (pinned to 165bb3c1a4)
Solutions
- Remove any script code that reassigns ArrayBuffer.isView or the ArrayBuffer global
- Disable libraries or shims that replace standard built-ins
- Send strings or Blobs instead of typed arrays to avoid the isView lookup entirely
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/js/modules/k6/websockets/websockets.go:699 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@165bb3c1a4 (2026-08-18).
Data as JSON: /api/errors/6c8a49a6324a07fc.
Report an issue: GitHub.