{"record":{"id":"15dcd9ea93149618","repo":"hyperledger/fabric","slug":"response-is-of-type-v-but-expected-a-block","errorCode":null,"errorMessage":"response is of type %v, but expected a block","messagePattern":"response is of type (.+?), but expected a block","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/deliver.go","lineNumber":480,"sourceCode":"\t\t\treturn nil, errors.New(\"block data is nil\")\n\t\t}\n\t\tif block.Header == nil {\n\t\t\treturn nil, errors.New(\"block header is nil\")\n\t\t}\n\t\tif block.Metadata == nil || len(block.Metadata.Metadata) == 0 {\n\t\t\treturn nil, errors.New(\"block metadata is empty\")\n\t\t}\n\t\treturn block, nil\n\tcase *orderer.DeliverResponse_Status:\n\t\tif t.Status == common.Status_FORBIDDEN {\n\t\t\treturn nil, ErrForbidden\n\t\t}\n\t\tif t.Status == common.Status_SERVICE_UNAVAILABLE {\n\t\t\treturn nil, ErrServiceUnavailable\n\t\t}\n\t\treturn nil, errors.Errorf(\"faulty node, received: %v\", resp)\n\tdefault:\n\t\treturn nil, errors.Errorf(\"response is of type %v, but expected a block\", reflect.TypeOf(resp.Type))\n\t}\n}\n\nfunc (p *BlockPuller) seekLastEnvelope() (*common.Envelope, error) {\n\treturn protoutil.CreateSignedEnvelopeWithTLSBinding(\n\t\tcommon.HeaderType_DELIVER_SEEK_INFO,\n\t\tp.Channel,\n\t\tp.Signer,\n\t\tlast(),\n\t\tint32(0),\n\t\tuint64(0),\n\t\tutil.ComputeSHA256(p.TLSCert),\n\t)\n}\n\nfunc (p *BlockPuller) seekNextEnvelope(startSeq uint64) (*common.Envelope, error) {\n\treturn protoutil.CreateSignedEnvelopeWithTLSBinding(\n\t\tcommon.HeaderType_DELIVER_SEEK_INFO,","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/deliver.go#L462-L498","documentation":"extractBlockFromResponse hits its default case when the DeliverResponse payload Type is not a DeliverResponse_BLOCK — the remote ordering node answered with a status (or nothing block-shaped) instead of the requested block. This means the deliver stream did not deliver what the BlockPuller asked for.","triggerScenarios":"The remote node returns a DeliverResponse whose Type is DeliverResponse_Status (e.g. NOT_FOUND, BAD_REQUEST, FORBIDDEN not matching the special-cased statuses) instead of a block; a malformed or foreign message on the deliver stream.","commonSituations":"Requesting a block (e.g. latest config block for eviction detection) from a node that no longer services the channel; fabric binary skew between nodes; corrupted or spoofed responses from a wrong endpoint.","solutions":["Check the status embedded in the response in the orderer logs to see why a block was not returned","Re-pull from a different cluster endpoint — the puller retries other endpoints automatically","Align Fabric versions across all ordering nodes","Verify the endpoint list in the cluster configuration points at actual consenter nodes of the channel"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if resp.GetType() != orderer.DeliverResponse_BLOCK { log.Printf(\"got status %v instead of block\", resp.GetStatus()) }","typeGuard":"func extractStatus(resp *orderer.DeliverResponse) (common.Status, bool) {\n    if resp == nil || resp.GetType() != orderer.DeliverResponse_Status { return 0, false }\n    return resp.GetStatus(), true\n}","tryCatchPattern":"blockResp, err := p.extractBlockFromResponse(resp)\nif err != nil {\n    var status common.Status\n    if resp.GetType() == orderer.DeliverResponse_Status { status = resp.GetStatus() }\n    // branch on status or retry another endpoint\n    return err\n}","preventionTips":["Pin the same Fabric release on every ordering node","Verify endpoint lists against the channel's consenter set","Log full DeliverResponse contents for diagnosis","Test deliver streams after any channel config update"],"tags":["fabric","orderer","raft","grpc"],"backgroundTag":"unexpected-deliver-response","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"}