{"record":{"id":"3e69e70bf8df6ba8","repo":"hyperledger/fabric","slug":"malformed-message","errorCode":null,"errorMessage":"malformed message","messagePattern":"malformed message","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"orderer/consensus/smartbft/ingress.go","lineNumber":53,"sourceCode":"}\n\n// Ingress dispatches Submit and Step requests to the designated per chain instances\ntype Ingress struct {\n\tLogger        WarningLogger\n\tChainSelector ReceiverGetter\n}\n\n// OnConsensus notifies the Ingress for a reception of a StepRequest from a given sender on a given channel\nfunc (in *Ingress) OnConsensus(channel string, sender uint64, request *ab.ConsensusRequest) error {\n\treceiver := in.ChainSelector.ReceiverByChain(channel)\n\tif receiver == nil {\n\t\tin.Logger.Warningf(\"An attempt to send a consensus request to a non existing channel (%s) was made by %d\", channel, sender)\n\t\treturn errors.Errorf(\"channel %s doesn't exist\", channel)\n\t}\n\tmsg := &protos.Message{}\n\tif err := proto.Unmarshal(request.Payload, msg); err != nil {\n\t\tin.Logger.Warningf(\"Malformed message: %v\", err)\n\t\treturn errors.Wrap(err, \"malformed message\")\n\t}\n\treceiver.HandleMessage(sender, msg)\n\treturn nil\n}\n\n// OnSubmit notifies the Ingress for a reception of a SubmitRequest from a given sender on a given channel\nfunc (in *Ingress) OnSubmit(channel string, sender uint64, request *ab.SubmitRequest) error {\n\treceiver := in.ChainSelector.ReceiverByChain(channel)\n\tif receiver == nil {\n\t\tin.Logger.Warningf(\"An attempt to submit a transaction to a non existing channel (%s) was made by %d\", channel, sender)\n\t\treturn errors.Errorf(\"channel %s doesn't exist\", channel)\n\t}\n\treceiver.HandleRequest(sender, protoutil.MarshalOrPanic(request.Payload))\n\treturn nil\n}\n","sourceCodeStart":35,"sourceCodeEnd":69,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/ingress.go#L35-L69","documentation":"After locating the chain, OnConsensus unmarshals the request payload into a protos.Message (the SmartBFT consensus message). If proto.Unmarshal fails — the payload is not a valid protobuf Message — the error is wrapped as 'malformed message' and returned; the message is dropped and never delivered to the consensus state machine.","triggerScenarios":"A remote sender transmits a ConsensusRequest whose Payload bytes fail proto unmarshaling into protos.Message — truncated payload, wrong message type wrapped, version mismatch between fabric nodes, or a non-consensus payload sent to the consensus ingress.","commonSituations":"Mixed fabric versions in a cluster where the consensus message schema differs; a corrupted or misrouted request from a malfunctioning peer; a client/sender incorrectly submitting to the consensus port; network corruption (rare, TLS usually prevents).","solutions":["Upgrade all ordering nodes to the same fabric version so consensus message schemas match","Check the sender identity in the log and inspect/fix the node sending malformed payloads (it may be misbehaving or corrupted)","Verify senders use the cluster consensus service (Step API) rather than submitting non-consensus payloads to this ingress","If corruption is suspected, restart the offending node and confirm TLS integrity between cluster members"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sender-side: verify the payload marshals cleanly before sending\npayload, err := proto.Marshal(msg)\nif err != nil { return err }\nvar check protos.Message\nif err := proto.Unmarshal(payload, &check); err != nil {\n    return fmt.Errorf(\"refusing to send unparseable consensus message: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := ingress.OnConsensus(channel, sender, req)\nif err != nil {\n    var wrapped string = err.Error()\n    if strings.Contains(wrapped, \"malformed message\") {\n        log.Warnf(\"dropping malformed consensus payload from sender %d on %s\", sender, channel)\n        return nil // drop; do not forward to consensus\n    }\n    return err\n}","preventionTips":["Keep all cluster nodes on the same fabric version","Never route non-consensus payloads to the consensus ingress port","Monitor for repeated malformed-message warnings from one sender — likely a misbehaving node to quarantine","Rely on TLS to prevent in-flight corruption; verify certs if warnings cluster"],"tags":["fabric","smartbft","protobuf","network","message-parsing"],"backgroundTag":"malformed-consensus-message","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}