grafana/k6 · error
data must be an ArrayBuffer, TypedArray, or DataView
Error message
data must be an ArrayBuffer, TypedArray, or DataView
What it means
Error "data must be an ArrayBuffer, TypedArray, or DataView" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/webcrypto/subtle_crypto.go:423
// - SHA-512
//
// The `data` parameter should contain the data to be digested.
func (sc *SubtleCrypto) Digest(algorithm sobek.Value, data sobek.Value) (*sobek.Promise, error) {
rt := sc.vu.Runtime()
var (
hashFn func() hash.Hash
bytes []byte
)
err := func() error {
var err error
// Validate that the value we received is either an ArrayBuffer, TypedArray, or DataView
// This uses the technique described in https://github.com/dop251/goja/issues/379#issuecomment-1164441879
if !IsInstanceOf(sc.vu.Runtime(), data, ArrayBufferConstructor, DataViewConstructor) &&
!IsTypedArray(sc.vu.Runtime(), data) {
return errors.New("data must be an ArrayBuffer, TypedArray, or DataView")
}
bytes, err = exportArrayBuffer(rt, data)
if err != nil {
return err
}
normalized, err := normalizeAlgorithm(rt, algorithm, OperationIdentifierDigest)
if err != nil {
return err
}
var ok bool
hashFn, ok = getHashFn(normalized.Name)
if !ok {
return NewError(
NotSupportedError,
"unsupported digest algorithm '"+normalized.Name+"', "+View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/webcrypto/subtle_crypto.go:423 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/72d1ab13d4a773b5.
Report an issue: GitHub.