grafana/k6 · error

unable to normalize number strings

Error message

unable to normalize number strings: %w

What it means

Raised in buildInvokeRequest when normalizeNumberStrings fails while walking the request object to convert number-like strings (int64/uint64 JSON safety) before marshalling. Usually a cyclic or otherwise non-normalizable object structure.

Solutions

  1. Inspect the wrapped error for the failing property
  2. Avoid cyclic references and exotic objects in the request payload
  3. Represent large integers as strings consistently so normalization is unnecessary
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/grpc/client.go:388 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18). Data as JSON: /api/errors/7fae7e6932237ca0. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/grpc/client.go:419

	if err != nil {
		return grpcReq, fmt.Errorf("invalid GRPC's client.invoke() parameters: %w", err)
	}

	// k6 GRPC Invoke's default timeout is 2 minutes
	if p.Timeout == time.Duration(0) {
		p.Timeout = 2 * time.Minute
	}

	if req == nil {
		return grpcReq, errors.New("request cannot be nil")
	}

	object := req.ToObject(c.vu.Runtime())

	var stack []*sobek.Object
	normalized, err := normalizeNumberStrings(object, c.vu.Runtime(), stack)
	if err != nil {
		return grpcReq, fmt.Errorf("unable to normalize number strings: %w", err)
	}

	b, err := normalized.ToObject(c.vu.Runtime()).MarshalJSON()
	if err != nil {
		return grpcReq, fmt.Errorf("unable to serialise request object: %w", err)
	}

	p.SetSystemTags(state, c.addr, method)

	return grpcext.InvokeRequest{
		Method:                 method,
		MethodDescriptor:       methodDesc,
		Timeout:                p.Timeout,
		DiscardResponseMessage: p.DiscardResponseMessage,
		Message:                b,
		TagsAndMeta:            &p.TagsAndMeta,
		Metadata:               p.Metadata,
	}, nil

View on GitHub (pinned to 8d06114777)