{"record":{"id":"72d1ab13d4a773b5","repo":"grafana/k6","slug":"data-must-be-an-arraybuffer-typedarray-or-datavi","errorCode":null,"errorMessage":"data must be an ArrayBuffer, TypedArray, or DataView","messagePattern":"data must be an ArrayBuffer, TypedArray, or DataView","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/subtle_crypto.go","lineNumber":423,"sourceCode":"//   - SHA-512\n//\n// The `data` parameter should contain the data to be digested.\nfunc (sc *SubtleCrypto) Digest(algorithm sobek.Value, data sobek.Value) (*sobek.Promise, error) {\n\trt := sc.vu.Runtime()\n\n\tvar (\n\t\thashFn func() hash.Hash\n\t\tbytes  []byte\n\t)\n\n\terr := func() error {\n\t\tvar err error\n\n\t\t// Validate that the value we received is either an ArrayBuffer, TypedArray, or DataView\n\t\t// This uses the technique described in https://github.com/dop251/goja/issues/379#issuecomment-1164441879\n\t\tif !IsInstanceOf(sc.vu.Runtime(), data, ArrayBufferConstructor, DataViewConstructor) &&\n\t\t\t!IsTypedArray(sc.vu.Runtime(), data) {\n\t\t\treturn errors.New(\"data must be an ArrayBuffer, TypedArray, or DataView\")\n\t\t}\n\n\t\tbytes, err = exportArrayBuffer(rt, data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnormalized, err := normalizeAlgorithm(rt, algorithm, OperationIdentifierDigest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar ok bool\n\t\thashFn, ok = getHashFn(normalized.Name)\n\t\tif !ok {\n\t\t\treturn NewError(\n\t\t\t\tNotSupportedError,\n\t\t\t\t\"unsupported digest algorithm '\"+normalized.Name+\"', \"+","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/webcrypto/subtle_crypto.go#L405-L441","documentation":"Error \"data must be an ArrayBuffer, TypedArray, or DataView\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/subtle_crypto.go:423 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}