{"record":{"id":"c2a52993db1f97de","repo":"hyperledger/fabric","slug":"txid-s-unsuppored-transaction-queries-on-pvt","errorCode":null,"errorMessage":"txid [%s]: unsuppored transaction. Queries on pvt data is supported only in a read-only transaction","messagePattern":"txid \\[(.+?)\\]: unsuppored transaction\\. Queries on pvt data is supported only in a read-only transaction","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/ledger/kvledger/txmgmt/txmgr/tx_simulator.go","lineNumber":237,"sourceCode":"}\n\nfunc (s *txSimulator) checkWritePrecondition(key string, value []byte) error {\n\tif err := s.checkDone(); err != nil {\n\t\treturn err\n\t}\n\tif err := s.checkPvtdataQueryPerformed(); err != nil {\n\t\treturn err\n\t}\n\tif err := s.checkPaginatedQueryPerformed(); err != nil {\n\t\treturn err\n\t}\n\ts.writePerformed = true\n\treturn s.queryExecutor.txmgr.db.ValidateKeyValue(key, value)\n}\n\nfunc (s *txSimulator) checkBeforePvtdataQueries() error {\n\tif s.writePerformed {\n\t\treturn errors.Errorf(\"txid [%s]: unsuppored transaction. Queries on pvt data is supported only in a read-only transaction\", s.txid)\n\t}\n\ts.pvtdataQueriesPerformed = true\n\treturn nil\n}\n\nfunc (s *txSimulator) checkPvtdataQueryPerformed() error {\n\tif s.pvtdataQueriesPerformed {\n\t\treturn errors.Errorf(\"txid [%s]: unsuppored transaction. Transaction has already performed queries on pvt data. Writes are not allowed\", s.txid)\n\t}\n\treturn nil\n}\n\nfunc (s *txSimulator) checkBeforePaginatedQueries() error {\n\tif s.writePerformed {\n\t\treturn errors.Errorf(\"txid [%s]: unsuppored transaction. Paginated queries are supported only in a read-only transaction\", s.txid)\n\t}\n\ts.paginatedQueriesPerformed = true\n\treturn nil","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/ledger/kvledger/txmgmt/txmgr/tx_simulator.go#L219-L255","documentation":"checkBeforePvtdataQueries detected a write was already performed on this simulator, then a private-data query was attempted. Fabric forbids mixing writes with pvtdata reads in one transaction to keep private reads consistent, so the transaction is rejected.","triggerScenarios":"Thrown at core/ledger/kvledger/txmgmt/txmgr/tx_simulator.go:237 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the transaction: perform pvt data queries in a read-only transaction","Avoid writes before private-data reads in the same simulation"],"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"}