{"record":{"id":"eec0a732ac4e122e","repo":"grpc-ecosystem/grpc-gateway","slug":"unsupported-body-field-type","errorCode":null,"errorMessage":"unsupported body field type","messagePattern":"unsupported body field type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoc-gen-grpc-gateway/internal/gengateway/template.go","lineNumber":71,"sourceCode":"\tif b.Body == nil || len(b.Body.FieldPath) == 0 {\n\t\treturn \"\", errors.New(\"no body field found\")\n\t}\n\n\tlastComponent := b.Body.FieldPath[len(b.Body.FieldPath)-1]\n\tfieldType := lastComponent.Target.GetType()\n\n\t// Handle message types\n\tif fieldType == descriptorpb.FieldDescriptorProto_TYPE_MESSAGE {\n\t\t// Get the parent message to provide proper lookup context\n\t\tparentMsg := lastComponent.Target.Message\n\t\tmsg, err := b.Registry.LookupMsg(parentMsg.FQMN(), lastComponent.Target.GetTypeName())\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to lookup message type %s: %w\", lastComponent.Target.GetTypeName(), err)\n\t\t}\n\t\treturn msg.GoType(b.Method.Service.File.GoPkg.Path), nil\n\t}\n\n\treturn \"\", errors.New(\"unsupported body field type\")\n}\n\n// HasQueryParam determines if the binding needs parameters in query string.\n//\n// It sometimes returns true even though actually the binding does not need.\n// But it is not serious because it just results in a small amount of extra codes generated.\nfunc (b binding) HasQueryParam() bool {\n\tif b.Body != nil && len(b.Body.FieldPath) == 0 {\n\t\treturn false\n\t}\n\tfields := make(map[string]bool)\n\tfor _, f := range b.Method.RequestType.Fields {\n\t\tfields[f.GetName()] = true\n\t}\n\tif b.Body != nil {\n\t\tdelete(fields, b.Body.FieldPath.String())\n\t}\n\tfor _, p := range b.PathParams {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-grpc-gateway/internal/gengateway/template.go#L53-L89","documentation":"Error from binding.GetBodyFieldType: the last component of the body FieldPath resolves to a protobuf field type the template generator cannot classify (not one of the supported message/primitive cases it handles). Generation of the request-body type for this binding stops because the field's kind is outside the generator's known mapping.","triggerScenarios":"Thrown at protoc-gen-grpc-gateway/internal/gengateway/template.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported field type (message or common scalar) as the body field in the HttpRule.","Point the body at a top-level message field rather than an exotic scalar/group type.","Update or pin the grpc-gateway version if the type support was added later."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}