{"record":{"id":"21404cf3e10456bb","repo":"hyperledger/fabric","slug":"failed-to-commit-private-data","errorCode":null,"errorMessage":"failed to commit private data","messagePattern":"failed to commit private data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gossip/privdata/reconcile.go","lineNumber":170,"sourceCode":"\t\t\t\tr.logger.Debug(\"Reconciliation cycle finished successfully. no items to reconcile\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tr.logger.Debug(\"got from ledger\", len(missingPvtDataInfo), \"blocks with missing private data, trying to reconcile...\")\n\n\t\tdig2collectionCfg, minB, maxB := r.getDig2CollectionConfig(missingPvtDataInfo)\n\t\tfetchedData, err := r.FetchReconciledItems(dig2collectionCfg)\n\t\tif err != nil {\n\t\t\tr.logger.Error(\"reconciliation error when trying to fetch missing items from different peers:\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tpvtDataToCommit := r.preparePvtDataToCommit(fetchedData.AvailableElements)\n\t\tunreconciled := constructUnreconciledMissingData(dig2collectionCfg, fetchedData.AvailableElements)\n\t\tpvtdataHashMismatch, err := r.CommitPvtDataOfOldBlocks(pvtDataToCommit, unreconciled)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to commit private data\")\n\t\t}\n\t\tr.logMismatched(pvtdataHashMismatch)\n\t\tif minB < minBlock {\n\t\t\tminBlock = minB\n\t\t}\n\t\tif maxB > maxBlock {\n\t\t\tmaxBlock = maxB\n\t\t}\n\t\ttotalReconciled += len(fetchedData.AvailableElements)\n\t}\n}\n\nfunc (r *Reconciler) reportReconciliationDuration(startTime time.Time) {\n\tr.metrics.ReconciliationDuration.With(\"channel\", r.channel).Observe(time.Since(startTime).Seconds())\n}\n\ntype collectionConfigKey struct {\n\tchaincodeName, collectionName string","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/gossip/privdata/reconcile.go#L152-L188","documentation":"The Reconciler pulls missing private data for old blocks from other peers and commits it via CommitPvtDataOfOldBlocks. This error wraps any failure returned by that ledger commit call during reconciliation, so the underlying cause is always in the wrapped error (e.g. hashing mismatch, ledger write failure, collection config unavailable). Reconciliation for that pass is aborted and retried on the next reconciliation interval.","triggerScenarios":"Calling Reconciler.run() -> reconcile() when preparePvtDataToCommit produces fetched private data and r.CommitPvtDataOfOldBlocks(pvtDataToCommit, unreconciled) returns a non-nil error.","commonSituations":"Ledger backend (LevelDB/CouchDB) write errors, invalid or mismatched collection configs discovered during commit, transient ledger unavailability during channel updates, or a bug producing rwsets that fail validation when written to the transient/private data store.","solutions":["Inspect the wrapped (cause) error in the log line to find the actual commit failure reason.","Check ledger/provider logs for storage errors (disk full, DB corruption) and fix the underlying storage issue.","Verify collection configurations for the affected chaincodes are consistent across the channel.","Wait for the next reconciliation cycle; reconciliation is periodic and retries failed commits automatically.","If persistent, restart the peer so the reconciler rebuilds state against a healthy ledger."],"exampleFix":"// before (diagnose)\nlog.Error(err) // failed to commit private data: <cause>\n// after (surface cause explicitly)\nif err != nil {\n    log.Errorf(\"failed to commit private data: %+v\", errors.Unwrap(err))\n}","handlingStrategy":"try-catch","validationCode":"// before triggering reconciliation commit, verify ledger is reachable\nif retriever, err := r.GetConfigHistoryRetriever(); err != nil {\n    log.Warningf(\"ledger not ready, skipping reconcile: %v\", err)\n    return\n}","typeGuard":null,"tryCatchPattern":"pvtDataToCommit := r.preparePvtDataToCommit(fetchedData.AvailableElements)\n_, err := r.CommitPvtDataOfOldBlocks(pvtDataToCommit, unreconciled)\nif err != nil {\n    log.Warningf(\"reconcile commit failed, will retry next cycle: %v\", err)\n    return // reconciliation retries periodically\n}","preventionTips":["Always log the wrapped cause of this error, not just the wrapper message.","Monitor ledger storage health (disk space, DB errors) on peers with private data enabled.","Keep collection configs consistent across channel members.","Rely on periodic reconciliation retries instead of aborting on first failure."],"tags":["hyperledger-fabric","gossip","private-data","ledger"],"backgroundTag":"private-data-commit-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"}