{"record":{"id":"cf2a0a54df84dd28","repo":"go-kratos/kratos","slug":"failed-to-unmarshal-message-is-t-want-proto-mes","errorCode":null,"errorMessage":"failed to unmarshal, message is %T, want proto.Message","messagePattern":"failed to unmarshal, message is %T, want proto\\.Message","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"encoding/protojson/protojson.go","lineNumber":47,"sourceCode":"\n// codec is a Codec implementation with protojson.\ntype codec struct{}\n\nfunc (codec) Marshal(v any) ([]byte, error) {\n\tm, ok := v.(proto.Message)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"failed to marshal, message is %T, want proto.Message\", v)\n\t}\n\treturn MarshalOptions.Marshal(m)\n}\n\nfunc (codec) Unmarshal(data []byte, v any) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tm, ok := v.(proto.Message)\n\tif !ok {\n\t\treturn fmt.Errorf(\"failed to unmarshal, message is %T, want proto.Message\", v)\n\t}\n\treturn UnmarshalOptions.Unmarshal(data, m)\n}\n\nfunc (codec) Name() string {\n\treturn Name\n}\n","sourceCodeStart":29,"sourceCodeEnd":55,"githubUrl":"https://github.com/go-kratos/kratos/blob/668db92c2c001e9552594ba5a8aede8456af6d7e/encoding/protojson/protojson.go#L29-L55","documentation":"Error \"failed to unmarshal, message is %T, want proto.Message\" thrown in go-kratos/kratos.","triggerScenarios":"Thrown at encoding/protojson/protojson.go:47 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"}