{"record":{"id":"400bf8285055f60c","repo":"prestodb/presto","slug":"hive-transaction-not-found","errorCode":"HIVE_TRANSACTION_NOT_FOUND","errorMessage":"Transaction not found: %s","messagePattern":"Transaction not found: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java","lineNumber":252,"sourceCode":"        this.cacheQuotaRequirementProvider = requireNonNull(cacheQuotaRequirementProvider, \"cacheQuotaRequirementProvider is null\");\n        this.encryptionInformationProvider = requireNonNull(encryptionInformationProvider, \"encryptionInformationProvider is null\");\n        this.partitionSkippabilityChecker = requireNonNull(partitionSkippabilityChecker, \"partitionSkippabilityChecker is null\");\n    }\n\n    @Override\n    public ConnectorSplitSource getSplits(\n            ConnectorTransactionHandle transaction,\n            ConnectorSession session,\n            ConnectorTableLayoutHandle layoutHandle,\n            SplitSchedulingContext splitSchedulingContext)\n    {\n        HiveTableLayoutHandle layout = (HiveTableLayoutHandle) layoutHandle;\n        SchemaTableName tableName = layout.getSchemaTableName();\n\n        // get table metadata\n        TransactionalMetadata metadata = hiveTransactionManager.get(transaction);\n        if (metadata == null) {\n            throw new PrestoException(HIVE_TRANSACTION_NOT_FOUND, format(\"Transaction not found: %s\", transaction));\n        }\n        SemiTransactionalHiveMetastore metastore = metadata.getMetastore();\n        MetastoreContext metastoreContext = new MetastoreContext(\n                session.getIdentity(),\n                session.getQueryId(),\n                session.getClientInfo(),\n                session.getClientTags(),\n                session.getSource(),\n                getMetastoreHeaders(session),\n                isUserDefinedTypeEncodingEnabled(session),\n                metastore.getColumnConverterProvider(),\n                session.getWarningCollector(),\n                session.getRuntimeStats());\n        Table table = layout.getTable(metastore, metastoreContext);\n\n        if (!isOfflineDataDebugModeEnabled(session)) {\n            // verify table is not marked as non-readable\n            String tableNotReadable = table.getParameters().get(OBJECT_NOT_READABLE);","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java#L234-L270","documentation":"The split manager looks up the connector transaction in HiveTransactionManager and finds no registered metadata for the supplied transaction handle. This indicates the transaction handle being used to read splits is unknown to this coordinator/worker — usually because it expired, was already finished, or the query state was lost (e.g. coordinator restart).","triggerScenarios":"HiveSplitManager.getSplits is called (via splitSource) with a TransactionHandle whose id has no entry in hiveTransactionManager — after coordinator restart mid-query, after the transaction was committed/aborted, or when a stale/cross-cluster handle is used.","commonSituations":"Long-running query outliving transaction cleanup; coordinator failover while a Hive scan is open; replaying a cached split source against a restarted server.","solutions":["Retry the query from the beginning so a fresh transaction handle is created.","Check for coordinator restarts/failover around the time of the failure and ensure query state is not being reused.","Verify clients are not caching or reusing split sources/transaction handles across queries.","If recurring, investigate transaction manager cleanup/TTL settings and coordinator stability."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { SplitSource src = splitSource(...); } catch (PrestoException e) { if (e.getErrorCode().getCode() == HIVE_TRANSACTION_NOT_FOUND.toErrorCode().getCode()) { /* discard stale handle, restart query with fresh transaction */ } else throw e; }","preventionTips":["Don't cache or reuse transaction/split-source handles across queries or coordinator restarts.","Avoid extremely long-running scans that can outlive transaction cleanup.","Monitor coordinator restarts and retry affected queries from scratch."],"tags":["hive","transaction","internal-state"],"backgroundTag":"transaction-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}