grafana/k6 · error

failed to process [blobParts]

Error message

failed to process [blobParts]: %w

What it means

Thrown by the Blob constructor when its first argument (blobParts) cannot be exported to a Go []any — sobek's ExportTo failed, meaning the value is not an array-like iterable of blob parts (e.g. a non-iterable object or a symbol). Thrown immediately via common.Throw, aborting construction.

Solutions

  1. Pass an array of parts: new Blob(['text', arrayBuffer, anotherBlob])
  2. Pass no arguments or an empty array if an empty Blob is intended
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/websockets/blob.go:32 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/10217a2d8d9eff99. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/websockets/blob.go:32

)

type blob struct {
	typ  string
	data *bytes.Buffer
}

func (b *blob) text() string {
	return b.data.String()
}

func (r *WebSocketsAPI) blob(call sobek.ConstructorCall) *sobek.Object {
	rt := r.vu.Runtime()

	b := &blob{data: new(bytes.Buffer)}
	var blobParts []any
	if len(call.Arguments) > 0 {
		if err := rt.ExportTo(call.Arguments[0], &blobParts); err != nil {
			common.Throw(rt, fmt.Errorf("failed to process [blobParts]: %w", err))
		}
	}

	if len(blobParts) > 0 {
		r.fillData(b, blobParts, call)
	}

	if len(call.Arguments) > 1 && !sobek.IsUndefined(call.Arguments[1]) {
		opts := call.Arguments[1]
		if !isObject(opts) {
			common.Throw(rt, errors.New("[options] must be an object"))
		}

		typeOpt := opts.ToObject(rt).Get("type")
		if !sobek.IsUndefined(typeOpt) {
			b.typ = typeOpt.String()
		}
	}

View on GitHub (pinned to 01ffac6f24)