{"record":{"id":"5f652328ece81c4c","repo":"go-kratos/kratos","slug":"http-stream-body-field-q-requires-a-proto-messag","errorCode":null,"errorMessage":"http: stream body field %q requires a proto.Message, got %T","messagePattern":"http: stream body field %q requires a proto\\.Message, got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"transport/http/stream.go","lineNumber":244,"sourceCode":"\t\tif err := DefaultRequestVars(s.req, m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// recvMessage decodes the next frame. When a named body field is declared the frame\n// carries only that field's payload, so it is decoded into a freshly allocated sub-message\n// and assigned back onto m; otherwise the frame is decoded into m directly. The generator\n// only declares a body field for a singular message-kind field, so a mismatch here is a\n// programming error and is reported rather than silently ignored.\nfunc (s *serverStream) recvMessage(m any) error {\n\tif s.bodyField == \"\" {\n\t\treturn s.RecvMsg(m)\n\t}\n\tpm, ok := m.(proto.Message)\n\tif !ok {\n\t\treturn fmt.Errorf(\"http: stream body field %q requires a proto.Message, got %T\", s.bodyField, m)\n\t}\n\tfd := pm.ProtoReflect().Descriptor().Fields().ByName(protoreflect.Name(s.bodyField))\n\tif fd == nil || fd.Kind() != protoreflect.MessageKind || fd.IsList() || fd.IsMap() {\n\t\treturn fmt.Errorf(\"http: stream body field %q is not a singular message field\", s.bodyField)\n\t}\n\tsub := pm.ProtoReflect().NewField(fd)\n\tif err := s.RecvMsg(sub.Message().Interface()); err != nil {\n\t\treturn err\n\t}\n\tpm.ProtoReflect().Set(fd, sub)\n\treturn nil\n}\n\nfunc (s *serverStream) SendAndClose(m any) error {\n\treturn s.SendMsg(m)\n}\n\nfunc (s *serverStream) SendMsg(m any) error {","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/go-kratos/kratos/blob/668db92c2c001e9552594ba5a8aede8456af6d7e/transport/http/stream.go#L226-L262","documentation":"Error \"http: stream body field %q requires a proto.Message, got %T\" thrown in go-kratos/kratos.","triggerScenarios":"Thrown at transport/http/stream.go:244 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"668db92c2c001e9552594ba5a8aede8456af6d7e","analyzedAt":"2026-08-16T02:07:20.704Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}