{"record":{"id":"069251f71674e38c","repo":"hyperledger/fabric","slug":"failed-to-marshal-updated-readiness-result","errorCode":null,"errorMessage":"failed to marshal updated readiness result","messagePattern":"failed to marshal updated readiness result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/checkcommitreadiness.go","lineNumber":212,"sourceCode":"\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\")\n\t\t}\n\t\tproposalResponse.Response.Payload = updatedPayload\n\n\t\treturn printResponseAsJSON(proposalResponse, &lb.CheckCommitReadinessResult{}, c.Writer)\n\t}\n\treturn c.printResponse(proposalResponse)\n}\n\n// mismatchItemWithDescription returns the item with its corresponding description\nfunc (c *CommitReadinessChecker) mismatchItemWithDescription(item string) string {\n\tdescriptions := map[string]string{\n\t\t\"ChaincodeParameters\": \"ChaincodeParameters (Check the Sequence, ChaincodeName)\",\n\t\t\"EndorsementInfo\":     \"EndorsementInfo (Check the Version, InitRequired, EndorsementPlugin)\",\n\t\t\"ValidationInfo\":      \"ValidationInfo (Check the ValidationParameter, ValidationPlugin)\",\n\t\t\"Collections\":         \"Collections (Check the Collections)\",\n\t}\n\n\tif description, ok := descriptions[item]; ok {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/checkcommitreadiness.go#L194-L230","documentation":"When JSON output is requested and the readiness result contains approval mismatches, the CLI enriches the result with descriptions, then re-marshals it with proto.Marshal before printing. This error means that re-marshaling the in-memory protobuf failed, which is rare and typically indicates corrupted in-memory state.","triggerScenarios":"proto.Marshal(readinessResult) returns an error after mismatchItemWithDescription enrichment ran on a CheckCommitReadinessResult with non-nil Mismatches and --output json set.","commonSituations":"Practically only seen with corrupted fields injected into the result (e.g. invalid mismatch data) or a bug; not from normal user configuration.","solutions":["Retry the command — this is usually transient or a bug","Omit --output json (use plain-text output) to bypass the re-marshal path","Run without inspection (omit --enable-inspection style flag) so mismatches aren't enriched","Report a bug with the wrapped error if reproducible"],"exampleFix":"// before\npeer lifecycle chaincode checkcommitreadiness --output json ...\n// after\npeer lifecycle chaincode checkcommitreadiness ...   # plain-text output skips enriched re-marshal","handlingStrategy":"fallback","validationCode":"// prefer plain output if json path is problematic\nif strings.ToLower(outputFormat) == \"json\" && inspectionEnabled { log.Println(\"json+inspection exercises re-marshal path\") }","typeGuard":"if readinessResult == nil || readinessResult.Mismatches == nil { skipRemarshal = true }","tryCatchPattern":"if _, err := proto.Marshal(readinessResult); err != nil { return printResponseAsJSON(proposalResponse, &lb.CheckCommitReadinessResult{}, w) }","preventionTips":["Keep CLI at the latest patch release (marshal bugs get fixed)","If it reproduces, capture the wrapped error and file a bug","Use plain-text output as a workaround"],"tags":["fabric","protobuf","marshal"],"backgroundTag":"protobuf-marshal-failed","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"}