{"record":{"id":"3f11d0931cf2672b","repo":"hyperledger/fabric","slug":"got-unexpected-sequence-from-s-d-instead-of","errorCode":null,"errorMessage":"got unexpected sequence from %s - (%d) instead of (%d)","messagePattern":"got unexpected sequence from (.+?) - \\((.+?)\\) instead of \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/deliver.go","lineNumber":239,"sourceCode":"\tvar totalSize int\n\tp.blockBuff = nil\n\tnextExpectedSequence := seq\n\tfor totalSize < p.MaxTotalBufferBytes && nextExpectedSequence <= p.latestSeq {\n\t\tresp, err := stream.Recv()\n\t\tif err != nil {\n\t\t\tp.Logger.Errorf(\"Failed receiving next block from %s: %v\", p.endpoint, err)\n\t\t\treturn err\n\t\t}\n\n\t\tblock, err := extractBlockFromResponse(resp)\n\t\tif err != nil {\n\t\t\tp.Logger.Errorf(\"Received a bad block from %s: %v\", p.endpoint, err)\n\t\t\treturn err\n\t\t}\n\t\tseq := block.Header.Number\n\t\tif seq != nextExpectedSequence {\n\t\t\tp.Logger.Errorf(\"Expected to receive sequence %d but got %d instead\", nextExpectedSequence, seq)\n\t\t\treturn errors.Errorf(\"got unexpected sequence from %s - (%d) instead of (%d)\", p.endpoint, seq, nextExpectedSequence)\n\t\t}\n\t\tsize := blockSize(block)\n\t\ttotalSize += size\n\t\tp.blockBuff = append(p.blockBuff, block)\n\t\tnextExpectedSequence++\n\t\tp.Logger.Infof(\"[channel: %s] Got block [%d] of size %d KB from %s\", p.Channel, seq, size/1024, p.endpoint)\n\t}\n\treturn nil\n}\n\nfunc (p *BlockPuller) obtainStream(reConnected bool, env *common.Envelope, seq uint64) (*ImpatientStream, error) {\n\tvar stream *ImpatientStream\n\tvar err error\n\tif reConnected {\n\t\tp.Logger.Infof(\"Sending request for block [%d] to %s\", seq, p.endpoint)\n\t\tstream, err = p.requestBlocks(p.endpoint, NewImpatientStream(p.conn, p.FetchTimeout), env)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/deliver.go#L221-L257","documentation":"pullBlocks expects blocks from a remote orderer to arrive in strict contiguous order starting at nextExpectedSequence. If a block arrives whose Header.Number differs from the expected sequence, the pull is aborted with this error because the stream is out of sync.","triggerScenarios":"During BlockPuller.pullBlocks (invoked via tryFetchBlock), the deliver stream returned block N+2 after N, or restarted at a different sequence than requested.","commonSituations":"Remote orderer underwent a fallback/consensus hiccup and served a different chain; the start sequence raced with block truncation on the remote node; reconnect landed on a lagging/forked node.","solutions":["Retry the pull against another orderer endpoint (standard behavior of the block puller)","Verify the remote node is not forked/lagging and is in-sync with the cluster","Check for channel reconfiguration/chain migration that may have altered block numbering, then re-pull from a verified height"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"block, err := puller.pullBlock(seq)\nif err != nil {\n    if strings.Contains(err.Error(), \"got unexpected sequence\") {\n        // fall back to another endpoint and restart the pull\n        block, err = pullerWithNextEndpoint.pullBlock(seq)\n    }\n}","preventionTips":["Pull only from orderers confirmed in-sync (probe heights first)","Monitor chain height divergence across the cluster","Investigate repeated sequence mismatches for forks or consensus failures","Re-pull from a verified start sequence after any channel migration"],"tags":["consensus","block-sync","ordering","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"}