{"record":{"id":"51f3f50229a92d35","repo":"hyperledger/fabric","slug":"error-unmarshalling-chaincodedeploymentspec","errorCode":null,"errorMessage":"error unmarshalling ChaincodeDeploymentSpec","messagePattern":"error unmarshalling ChaincodeDeploymentSpec","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoutil/unmarshalers.go","lineNumber":33,"sourceCode":"\t\"github.com/pkg/errors\"\n\t\"google.golang.org/protobuf/proto\"\n)\n\n// the implicit contract of all these unmarshalers is that they\n// will return a non-nil pointer whenever the error is nil\n\n// UnmarshalBlock unmarshals bytes to a Block\nfunc UnmarshalBlock(encoded []byte) (*common.Block, error) {\n\tblock := &common.Block{}\n\terr := proto.Unmarshal(encoded, block)\n\treturn block, errors.Wrap(err, \"error unmarshalling Block\")\n}\n\n// UnmarshalChaincodeDeploymentSpec unmarshals bytes to a ChaincodeDeploymentSpec\nfunc UnmarshalChaincodeDeploymentSpec(code []byte) (*peer.ChaincodeDeploymentSpec, error) {\n\tcds := &peer.ChaincodeDeploymentSpec{}\n\terr := proto.Unmarshal(code, cds)\n\treturn cds, errors.Wrap(err, \"error unmarshalling ChaincodeDeploymentSpec\")\n}\n\n// UnmarshalChaincodeInvocationSpec unmarshals bytes to a ChaincodeInvocationSpec\nfunc UnmarshalChaincodeInvocationSpec(encoded []byte) (*peer.ChaincodeInvocationSpec, error) {\n\tcis := &peer.ChaincodeInvocationSpec{}\n\terr := proto.Unmarshal(encoded, cis)\n\treturn cis, errors.Wrap(err, \"error unmarshalling ChaincodeInvocationSpec\")\n}\n\n// UnmarshalPayload unmarshals bytes to a Payload\nfunc UnmarshalPayload(encoded []byte) (*common.Payload, error) {\n\tpayload := &common.Payload{}\n\terr := proto.Unmarshal(encoded, payload)\n\treturn payload, errors.Wrap(err, \"error unmarshalling Payload\")\n}\n\n// UnmarshalEnvelope unmarshals bytes to a Envelope\nfunc UnmarshalEnvelope(encoded []byte) (*common.Envelope, error) {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/protoutil/unmarshalers.go#L15-L51","documentation":"UnmarshalChaincodeDeploymentSpec wraps a proto.Unmarshal failure: the bytes are not a valid ChaincodeDeploymentSpec message — typically a corrupted deployment payload or bytes of a different type passed to the wrong unmarshaler.","triggerScenarios":"Thrown at protoutil/unmarshalers.go:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-package/re-deploy the chaincode so the payload is a valid ChaincodeDeploymentSpec","Verify the bytes were not truncated in transit"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}