grafana/k6 · error
unable to serialise request object to protocol buffer: %w
Error message
unable to serialise request object to protocol buffer: %w
What it means
protojson failed to unmarshal the client.invoke() message bytes into a dynamic message built from the method's input descriptor. Despite saying 'serialise', the failing step is decoding the request JSON: unknown fields, wrong types for proto fields, or malformed JSON that does not match the .proto schema. Raised per-call after the request has passed the descriptor and non-empty-message guards.
Source
Thrown at internal/lib/netext/grpcext/conn.go:153
if req.MethodDescriptor == nil {
return nil, fmt.Errorf("request method descriptor is required")
}
if len(req.Message) == 0 {
return nil, fmt.Errorf("request message is required")
}
if req.Timeout != time.Duration(0) {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, req.Timeout)
defer cancel()
}
ctx = metadata.NewOutgoingContext(ctx, req.Metadata)
reqdm := dynamicpb.NewMessage(req.MethodDescriptor.Input())
if err := (protojson.UnmarshalOptions{Resolver: c.types}).Unmarshal(req.Message, reqdm); err != nil {
return nil, fmt.Errorf("unable to serialise request object to protocol buffer: %w", err)
}
ctx = withRPCState(ctx, &rpcState{tagsAndMeta: req.TagsAndMeta})
var resp *dynamicpb.Message
if req.DiscardResponseMessage {
resp = dynamicpb.NewMessage((&emptypb.Empty{}).ProtoReflect().Descriptor())
} else {
resp = dynamicpb.NewMessage(req.MethodDescriptor.Output())
}
header, trailer := metadata.New(nil), metadata.New(nil)
copts := make([]grpc.CallOption, 0, len(opts)+2)
copts = append(copts, opts...)
copts = append(copts, grpc.Header(&header), grpc.Trailer(&trailer))
err := c.raw.Invoke(ctx, req.Method, reqdm, resp, copts...)View on GitHub (pinned to 01ffac6f24)
Solutions
- Match the message object exactly to the method's request schema: correct field names, types, and nesting
- Enum values must be valid names; int64 fields should be strings or numbers within range
- Remove unknown/extra fields, or verify the service was reflected from the up-to-date proto definition
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/lib/netext/grpcext/conn.go:153 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/611085c37a9f9976.
Report an issue: GitHub.