{"record":{"id":"611085c37a9f9976","repo":"grafana/k6","slug":"unable-to-serialise-request-object-to-protocol-buf","errorCode":null,"errorMessage":"unable to serialise request object to protocol buffer: %w","messagePattern":"unable to serialise request object to protocol buffer: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/lib/netext/grpcext/conn.go","lineNumber":153,"sourceCode":"\n\tif req.MethodDescriptor == nil {\n\t\treturn nil, fmt.Errorf(\"request method descriptor is required\")\n\t}\n\tif len(req.Message) == 0 {\n\t\treturn nil, fmt.Errorf(\"request message is required\")\n\t}\n\n\tif req.Timeout != time.Duration(0) {\n\t\tvar cancel context.CancelFunc\n\t\tctx, cancel = context.WithTimeout(ctx, req.Timeout)\n\t\tdefer cancel()\n\t}\n\n\tctx = metadata.NewOutgoingContext(ctx, req.Metadata)\n\n\treqdm := dynamicpb.NewMessage(req.MethodDescriptor.Input())\n\tif err := (protojson.UnmarshalOptions{Resolver: c.types}).Unmarshal(req.Message, reqdm); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to serialise request object to protocol buffer: %w\", err)\n\t}\n\n\tctx = withRPCState(ctx, &rpcState{tagsAndMeta: req.TagsAndMeta})\n\n\tvar resp *dynamicpb.Message\n\tif req.DiscardResponseMessage {\n\t\tresp = dynamicpb.NewMessage((&emptypb.Empty{}).ProtoReflect().Descriptor())\n\t} else {\n\t\tresp = dynamicpb.NewMessage(req.MethodDescriptor.Output())\n\t}\n\n\theader, trailer := metadata.New(nil), metadata.New(nil)\n\n\tcopts := make([]grpc.CallOption, 0, len(opts)+2)\n\tcopts = append(copts, opts...)\n\tcopts = append(copts, grpc.Header(&header), grpc.Trailer(&trailer))\n\n\terr := c.raw.Invoke(ctx, req.Method, reqdm, resp, copts...)","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/lib/netext/grpcext/conn.go#L135-L171","documentation":"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.","triggerScenarios":"Thrown at internal/lib/netext/grpcext/conn.go:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}