{"record":{"id":"2deb9e46e65cbbd9","repo":"grpc-ecosystem/grpc-gateway","slug":"no-body-field-found","errorCode":null,"errorMessage":"no body field found","messagePattern":"no body field found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoc-gen-grpc-gateway/internal/gengateway/template.go","lineNumber":48,"sourceCode":"\tRegistry          *descriptor.Registry\n\tAllowPatchFeature bool\n\tUseOpaqueAPI      bool\n}\n\n// GetBodyFieldPath returns the binding body's field path.\nfunc (b binding) GetBodyFieldPath() string {\n\tif b.Body != nil && len(b.Body.FieldPath) != 0 {\n\t\treturn b.Body.FieldPath.String()\n\t}\n\treturn \"*\"\n}\n\n// GetBodyFieldStructName returns the binding body's struct field name.\nfunc (b binding) GetBodyFieldStructName() (string, error) {\n\tif b.Body != nil && len(b.Body.FieldPath) != 0 {\n\t\treturn casing.Camel(b.Body.FieldPath.String()), nil\n\t}\n\treturn \"\", errors.New(\"no body field found\")\n}\n\n// GetBodyFieldType returns the Go type of the body field.\nfunc (b binding) GetBodyFieldType() (string, error) {\n\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)","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-grpc-gateway/internal/gengateway/template.go#L30-L66","documentation":"Template-time error from binding.GetBodyFieldStructName: the binding has no body (Body nil or empty FieldPath), so there is no camel-cased struct field name to return. The generator template called it for a binding that does not carry a request body (e.g. a GET-style binding); '*' is the placeholder used by GetBodyFieldPath instead.","triggerScenarios":"Thrown at protoc-gen-grpc-gateway/internal/gengateway/template.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only call GetBodyFieldStructName when the binding has Body != nil with a non-empty FieldPath.","Use GetBodyFieldPath() which falls back to \"*\" for body-less bindings.","Add a body: \"...\" clause to the HttpRule if a body was intended."],"exampleFix":null,"handlingStrategy":"type-guard","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"}