hyperledger/fabric · warning

failed to unmarshal proposal response's response payload

Error message

failed to unmarshal proposal response's response payload

What it means

After a successful install endorsement, submitInstallProposal() failed to proto-unmarshal Response.Payload into lb.InstallChaincodeResult, which should contain the PackageId. The success response body does not match the expected protobuf schema.

Source

Thrown at internal/peer/lifecycle/chaincode/install.go:173

	}

	if proposalResponse == nil {
		return errors.New("chaincode install failed: received nil proposal response")
	}

	if proposalResponse.Response == nil {
		return errors.New("chaincode install failed: received proposal response with nil response")
	}

	if proposalResponse.Response.Status != int32(cb.Status_SUCCESS) {
		return errors.Errorf("chaincode install failed with status: %d - %s", proposalResponse.Response.Status, proposalResponse.Response.Message)
	}
	logger.Infof("Installed remotely: %v", proposalResponse)

	icr := &lb.InstallChaincodeResult{}
	err = proto.Unmarshal(proposalResponse.Response.Payload, icr)
	if err != nil {
		return errors.Wrap(err, "failed to unmarshal proposal response's response payload")
	}
	logger.Infof("Chaincode code package identifier: %s", icr.PackageId)

	return nil
}

func (i *Installer) createInstallProposal(pkgBytes []byte, creatorBytes []byte) (*pb.Proposal, error) {
	installChaincodeArgs := &lb.InstallChaincodeArgs{
		ChaincodeInstallPackage: pkgBytes,
	}

	installChaincodeArgsBytes, err := proto.Marshal(installChaincodeArgs)
	if err != nil {
		return nil, errors.Wrap(err, "failed to marshal InstallChaincodeArgs")
	}

	ccInput := &pb.ChaincodeInput{Args: [][]byte{[]byte("InstallChaincode"), installChaincodeArgsBytes}}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Align peer CLI binary version with the peer node's Fabric version.
  2. Retry the command; note the install itself may have succeeded — verify with `peer lifecycle chaincode queryinstalled`.
  3. Inspect peer logs to see what the peer serialized.
  4. Rebuild the CLI from the matching Fabric release tag if using a custom build.

Example fix

// before: mismatched binaries
./peer-2.2 lifecycle chaincode install --path mycc.tar.gz  # peer runs v2.5
// after
./peer-2.5 lifecycle chaincode install --path mycc.tar.gz
Defensive patterns

Strategy: try-catch

Validate before calling

// check version compatibility before running lifecycle commands
cliVer, peerVer := getCliVersion(), getPeerVersion()
if cliVer != peerVer {
    return fmt.Errorf("CLI %s does not match peer %s", cliVer, peerVer)
}

Type guard

func validInstallResult(b []byte) (*lb.InstallChaincodeResult, bool) {
    r := &lb.InstallChaincodeResult{}
    if proto.Unmarshal(b, r) != nil || r.PackageId == "" { return nil, false }
    return r, true
}

Try / catch

if err := install(); err != nil {
    if strings.Contains(err.Error(), "failed to unmarshal") {
        // install likely succeeded; verify with queryinstalled
        return verifyInstalled(pkgLabel)
    }
    return err
}

Prevention

When it happens

Trigger: proto.Unmarshal(proposalResponse.Response.Payload, icr) errors right after a SUCCESS install response, e.g. payload produced by a peer running a different Fabric version's _lifecycle result type.

Common situations: Version-skew between peer CLI and peer node binaries; custom/patched peers emitting different payloads; truncated payloads from flaky network layers.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


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