{"record":{"id":"5697a642b95c03d9","repo":"hyperledger/fabric","slug":"private-data-matching-public-hash-version-is-not-a","errorCode":null,"errorMessage":"private data matching public hash version is not available. Public hash version = %s, Private data version = %s","messagePattern":"private data matching public hash version is not available\\. Public hash version = (.+?), Private data version = (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/ledger/kvledger/txmgmt/txmgr/query_executor.go","lineNumber":218,"sourceCode":"\t}\n\n\tvar err error\n\tvar hashVersion *version.Height\n\tvar versionedValue *statedb.VersionedValue\n\n\tif versionedValue, err = q.txmgr.db.GetPrivateData(ns, coll, key); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// metadata is always nil for private data - because, the metadata is part of the hashed key (instead of raw key)\n\tval, _, ver := decomposeVersionedValue(versionedValue)\n\n\tkeyHash := util.ComputeStringHash(key)\n\tif hashVersion, err = q.txmgr.db.GetKeyHashVersion(ns, coll, keyHash); err != nil {\n\t\treturn nil, err\n\t}\n\tif !version.AreSame(hashVersion, ver) {\n\t\treturn nil, errors.Errorf(\n\t\t\t\"private data matching public hash version is not available. Public hash version = %s, Private data version = %s\",\n\t\t\thashVersion, ver,\n\t\t)\n\t}\n\tif q.collectReadset {\n\t\tq.rwsetBuilder.AddToHashedReadSet(ns, coll, key, ver)\n\t\tq.privateReads.Add(ns, coll)\n\t}\n\treturn val, nil\n}\n\nfunc (q *queryExecutor) GetPrivateDataHash(ns, coll, key string) ([]byte, error) {\n\tif err := q.validateCollName(ns, coll); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := q.checkDone(); err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/ledger/kvledger/txmgmt/txmgr/query_executor.go#L200-L236","documentation":"GetPrivateData compared the version of the private value with the version of the corresponding public key hash and they differ — the private data and its hash commitment are out of sync, typically because the pvt data write for that block was missing and only a purge/hash update advanced.","triggerScenarios":"Thrown at core/ledger/kvledger/txmgmt/txmgr/query_executor.go:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the peer received the missing private data (gossip/reconciliation) before reading","Reconcile private data from other eligible peers","Avoid reading keys whose hash version advanced past the private version"],"exampleFix":null,"handlingStrategy":"validation","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-08T10:18:20.063Z"}