{"record":{"id":"f17110a3f3a8b51b","repo":"hyperledger/fabric","slug":"failed-to-unmarshal-readiness-result","errorCode":null,"errorMessage":"failed to unmarshal readiness result","messagePattern":"failed to unmarshal readiness result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/checkcommitreadiness.go","lineNumber":194,"sourceCode":"\n\tif proposalResponse == nil {\n\t\treturn errors.New(\"received nil proposal response\")\n\t}\n\n\tif proposalResponse.Response == nil {\n\t\treturn errors.New(\"received proposal response with nil response\")\n\t}\n\n\tif proposalResponse.Response.Status != int32(cb.Status_SUCCESS) {\n\t\treturn errors.Errorf(\"query failed with status: %d - %s\", proposalResponse.Response.Status, proposalResponse.Response.Message)\n\t}\n\n\tif strings.ToLower(c.Input.OutputFormat) == \"json\" {\n\t\t// Unmarshal the proposal response to add descriptions to mismatch items\n\t\treadinessResult := &lb.CheckCommitReadinessResult{}\n\t\terr := proto.Unmarshal(proposalResponse.Response.Payload, readinessResult)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to unmarshal readiness result\")\n\t\t}\n\n\t\tif c.Input.InspectionEnabled {\n\t\t\tfor org, mismatches := range readinessResult.Mismatches {\n\t\t\t\tfor i, item := range mismatches.Items {\n\t\t\t\t\tmismatches.Items[i] = c.mismatchItemWithDescription(item)\n\t\t\t\t}\n\t\t\t\treadinessResult.Mismatches[org] = mismatches\n\t\t\t}\n\t\t} else {\n\t\t\t// If InspectionEnabled flag is OFF, clear the Mismatches\n\t\t\treadinessResult.Mismatches = nil\n\t\t}\n\n\t\t// Marshal back to proposalResponse\n\t\tupdatedPayload, err := proto.Marshal(readinessResult)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to marshal updated readiness result\")","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/checkcommitreadiness.go#L176-L212","documentation":"After a successful readiness query, the CLI unmarshals the response payload into a CheckCommitReadinessResult protobuf. This error means the payload bytes returned by the peer could not be parsed as that protobuf message, wrapped with the underlying unmarshal error.","triggerScenarios":"proto.Unmarshal(proposalResponse.Response.Payload, readinessResult) fails — the peer returned a payload that is not a valid CheckCommitReadinessResult (mismatched peer/CLI versions, corrupted or unexpected payload).","commonSituations":"Mixed Fabric v1.x/v2.x network where the peer responds with a different payload format; custom/incompatible peer build; proxy or middleware mangling response bytes.","solutions":["Ensure peer and CLI binaries are the same Fabric major version (2.x)","Retry against a different peer to rule out a single bad peer","Inspect the wrapped err for protobuf parse details to identify the payload format mismatch","Upgrade/downgrade fabric binaries so the lifecycle protobuf schema matches"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure peer and CLI versions match before querying\nout, _ := exec.Command(\"peer\", \"version\").Output()\nif !strings.Contains(string(out), \"2.\") { log.Fatal(\"CLI must be Fabric 2.x to match peers\") }","typeGuard":"if len(proposalResponse.Response.Payload) == 0 { return errors.New(\"empty payload\") }","tryCatchPattern":"if _, err := proto.Unmarshal(payload, &lb.CheckCommitReadinessResult{}); err != nil { log.Printf(\"payload not a CheckCommitReadinessResult: %v\", err) }","preventionTips":["Keep peer and CLI binaries on the same Fabric release","Avoid proxies that buffer/rewrite gRPC responses","Test one peer first before scripting across the network"],"tags":["fabric","protobuf","unmarshal"],"backgroundTag":"protobuf-unmarshal-failed","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"}