hyperledger/fabric · error

received unexpected response type (%T) from %s

Error message

received unexpected response type (%T) from %s

What it means

ClientWait's switch handles FilteredBlock and Status deliver responses; any other response type (e.g. a full Block when filtered deliver was expected) falls into the default case and is reported as unexpected for the given peer address.

Source

Thrown at internal/peer/chaincode/common.go:750

		switch r := resp.Type.(type) {
		case *pb.DeliverResponse_FilteredBlock:
			filteredTransactions := r.FilteredBlock.FilteredTransactions
			for _, tx := range filteredTransactions {
				if tx.Txid == dg.TxID {
					logger.Infof("txid [%s] committed with status (%s) at %s", dg.TxID, tx.TxValidationCode, dc.Address)
					if tx.TxValidationCode != pb.TxValidationCode_VALID {
						err = errors.Errorf("transaction invalidated with status (%s)", tx.TxValidationCode)
						dg.setError(err)
					}
					return
				}
			}
		case *pb.DeliverResponse_Status:
			err = errors.Errorf("deliver completed with status (%s) before txid received", r.Status)
			dg.setError(err)
			return
		default:
			err = errors.Errorf("received unexpected response type (%T) from %s", r, dc.Address)
			dg.setError(err)
			return
		}
	}
}

// WaitForWG waits for the deliverGroup's wait group and closes
// the channel when ready
func (dg *DeliverGroup) WaitForWG(readyCh chan struct{}) {
	dg.wg.Wait()
	close(readyCh)
}

// setError serializes an error for the deliverGroup
func (dg *DeliverGroup) setError(err error) {
	dg.mutex.Lock()
	dg.Error = err
	dg.mutex.Unlock()

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Align CLI and peer versions (same Fabric release line)
  2. Check whether a proxy or intermediary is rewriting deliver responses
  3. Inspect peer logs for the delivered response type; report a bug to Fabric if stock versions reproduce it

Example fix

// before
// CLI v1.4 (unfiltered deliver) talking to v2.x peer
// after
// upgrade CLI binaries to match peer version
peer version  # ensure 2.x matches peers, then retry
Defensive patterns

Strategy: retry

Validate before calling

if cliVersionMajor != peerVersionMajor {
    return fmt.Errorf("CLI (%s) and peer (%s) versions must match", cliVersion, peerVersion)
}

Try / catch

if strings.Contains(err.Error(), "received unexpected response type") {
    // protocol mismatch: upgrade CLI/peer to matching versions and retry
    return retryAfterVersionAlignment(ctx)
}

Prevention

When it happens

Trigger: The deliver server sends a response type outside the expected set — usually a protocol/registration mismatch, e.g. registering for full-block deliver but receiving Block responses in a code path expecting filtered blocks, or a Fabric version mismatch between CLI and peer.

Common situations: Mixed-version Fabric networks (CLI older/newer than peer); custom deliver intermediaries/proxies; bugs in new response types introduced by upgrades.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/9bbed3e808ab0256. Report an issue: GitHub.