{"record":{"id":"59b98cc5381fe310","repo":"hyperledger/fabric","slug":"invalid-pullmsgtype-s","errorCode":null,"errorMessage":"Invalid PullMsgType: %s","messagePattern":"Invalid PullMsgType: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gossip/protoext/message.go","lineNumber":167,"sourceCode":"\t\t\treturn fmt.Errorf(\"Tag should be %s\", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_ORG_ONLY)])\n\t\t}\n\t\treturn nil\n\t}\n\n\tif IsPullMsg(m) {\n\t\tswitch GetPullMsgType(m) {\n\t\tcase gossip.PullMsgType_BLOCK_MSG:\n\t\t\tif m.Tag != gossip.GossipMessage_CHAN_AND_ORG {\n\t\t\t\treturn fmt.Errorf(\"Tag should be %s\", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_CHAN_AND_ORG)])\n\t\t\t}\n\t\t\treturn nil\n\t\tcase gossip.PullMsgType_IDENTITY_MSG:\n\t\t\tif m.Tag != gossip.GossipMessage_EMPTY {\n\t\t\t\treturn fmt.Errorf(\"Tag should be %s\", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_EMPTY)])\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Invalid PullMsgType: %s\", gossip.PullMsgType_name[int32(GetPullMsgType(m))])\n\t\t}\n\t}\n\n\tif IsStateInfoMsg(m) || IsStateInfoPullRequestMsg(m) || IsStateInfoSnapshot(m) || IsRemoteStateMessage(m) {\n\t\tif m.Tag != gossip.GossipMessage_CHAN_OR_ORG {\n\t\t\treturn fmt.Errorf(\"Tag should be %s\", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_CHAN_OR_ORG)])\n\t\t}\n\t\treturn nil\n\t}\n\n\tif IsLeadershipMsg(m) {\n\t\tif m.Tag != gossip.GossipMessage_CHAN_AND_ORG {\n\t\t\treturn fmt.Errorf(\"Tag should be %s\", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_CHAN_AND_ORG)])\n\t\t}\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"Unknown message type: %v\", m)","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/gossip/protoext/message.go#L149-L185","documentation":"Sentinel-style validation guard in IsTagLegal: a pull-type GossipMessage (BLOCK_MSG or IDENTITY_MSG) carries a Tag that does not match the tag required for its pull message type, so the message is rejected before further processing. The %s is the name of the expected tag (e.g. CHAN_AND_ORG or EMPTY).","triggerScenarios":"Calling IsTagLegal on a message where GetPullMsgType(m) returns a value not in {BLOCK_MSG, IDENTITY_MSG} — e.g. an uninitialized, zero-but-unknown enum value, or a payload set as pull without a valid PullMsgType.","commonSituations":"Proto evolution adding a new PullMsgType not yet handled by this validator; corrupted or truncated payloads misdecoded as pull messages; hand-built test messages with arbitrary pull types.","solutions":["Only send PullMsgType_BLOCK_MSG or PullMsgType_IDENTITY_MSG pull messages","Check enum values against gossip.PullMsgType_name to ensure a defined type is set","Upgrade fabric so the validator recognizes any newly added pull message type"],"exampleFix":"// before\nmsg.Content = &gossip.GossipMessage_PullMsg{PullMsgType: gossip.PullMsgType(9)}\n// after\nmsg.Content = &gossip.GossipMessage_PullMsg{PullMsgType: gossip.PullMsgType_BLOCK_MSG}","handlingStrategy":"validation","validationCode":"t := protoext.GetPullMsgType(msg)\nif t != gossip.PullMsgType_BLOCK_MSG && t != gossip.PullMsgType_IDENTITY_MSG {\n    return fmt.Errorf(\"unsupported pull msg type: %v\", t)\n}","typeGuard":"func hasKnownPullType(m *gossip.GossipMessage) bool {\n    t := protoext.GetPullMsgType(m)\n    return t == gossip.PullMsgType_BLOCK_MSG || t == gossip.PullMsgType_IDENTITY_MSG\n}","tryCatchPattern":null,"preventionTips":["Only use the named PullMsgType enum constants","Keep fabric versions aligned across peers","Check gossip.PullMsgType_name to confirm the type is defined"],"tags":["gossip","hyperledger-fabric","validation"],"backgroundTag":"gossip-message-tag-mismatch","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"}