{"record":{"id":"571e1bed0c039f23","repo":"hyperledger/fabric","slug":"claimed-seqnum-is-d-but-actual-seqnum-inside-bl","errorCode":null,"errorMessage":"Claimed seqNum is [%d] but actual seqNum inside block is [%d]","messagePattern":"Claimed seqNum is \\[(.+?)\\] but actual seqNum inside block is \\[(.+?)\\]","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/peer/gossip/mcs.go","lineNumber":135,"sourceCode":"\tif err != nil {\n\t\tmcsLogger.Errorf(\"Failed computing digest of serialized identity %s: [%s]\", peerIdentity, err)\n\t\treturn nil\n\t}\n\n\treturn digest\n}\n\n// VerifyBlock returns nil if the block is properly signed, and the claimed seqNum is the\n// sequence number that the block's header contains.\n// else returns error\nfunc (s *MSPMessageCryptoService) VerifyBlock(chainID common.ChannelID, seqNum uint64, block *pcommon.Block) error {\n\tif block.Header == nil {\n\t\treturn fmt.Errorf(\"Invalid Block on channel [%s]. Header must be different from nil.\", chainID)\n\t}\n\n\tblockSeqNum := block.Header.Number\n\tif seqNum != blockSeqNum {\n\t\treturn fmt.Errorf(\"Claimed seqNum is [%d] but actual seqNum inside block is [%d]\", seqNum, blockSeqNum)\n\t}\n\n\t// - Extract channelID and compare with chainID\n\tchannelID, err := protoutil.GetChannelIDFromBlock(block)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed getting channel id from block with id [%d] on channel [%s]: [%s]\", block.Header.Number, chainID, err)\n\t}\n\n\tif channelID != string(chainID) {\n\t\treturn fmt.Errorf(\"Invalid block's channel id. Expected [%s]. Given [%s]\", chainID, channelID)\n\t}\n\n\t// - Unmarshal medatada\n\tif block.Metadata == nil || len(block.Metadata.Metadata) == 0 {\n\t\treturn fmt.Errorf(\"Block with id [%d] on channel [%s] does not have metadata. Block not valid.\", block.Header.Number, chainID)\n\t}\n\n\tdataHash, err := protoutil.BlockDataHash(block.Data)","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/gossip/mcs.go#L117-L153","documentation":"VerifyBlock confirms that the sequence number claimed by the gossip message matches the actual block number inside the block header. If seqNum != block.Header.Number the block does not correspond to the message, so validation fails with both numbers in the message.","triggerScenarios":"Gossip delivery/state-transfer passes a block whose Header.Number differs from the seqNum the peer claims — e.g. stale message replayed after ledger advanced, or mis-indexed block in a pull.","commonSituations":"Network partitions causing stale gossip payloads; replayed anti-entropy messages; a bug in block puller assigning wrong sequence numbers after a checkpoint/resync.","solutions":["Let gossip discard the stale payload (this error is expected handling for out-of-sync blocks)","If persistent, resync the peer: pull latest blocks from the orderer or a healthy peer","Check for ordering/kafka-raft misconfiguration if many peers report mismatches"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"func seqMatches(b *pcommon.Block, claimed uint64) bool {\n    return b != nil && b.Header != nil && b.Header.Number == claimed\n}","typeGuard":"func seqMatches(b *pcommon.Block, claimed uint64) bool {\n    return b != nil && b.Header != nil && b.Header.Number == claimed\n}\n\nif !seqMatches(block, seqNum) {\n    // skip stale payload; gossip will deliver a fresh one\n    return nil\n}","tryCatchPattern":"if err := cryptoService.VerifyBlock(chainID, seqNum, block); err != nil {\n    if strings.Contains(err.Error(), \"Claimed seqNum\") {\n        log.Debugf(\"stale/seq-mismatched block, ignoring: %v\", err)\n        return nil\n    }\n    return err\n}","preventionTips":["Treat seq mismatch as normal gossip churn — do not crash the service","Monitor how often mismatches occur; frequent ones indicate syncing problems","Re-pull blocks from the orderer after long partitions"],"tags":["fabric","gossip","block-sequence"],"backgroundTag":"block-sequence-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"}