prestodb/presto · error · PrestoException

HIVE_TRANSACTION_NOT_FOUND

HIVE_TRANSACTION_NOT_FOUND

Error message

Transaction not found: %s

What it means

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).

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java:252

        this.cacheQuotaRequirementProvider = requireNonNull(cacheQuotaRequirementProvider, "cacheQuotaRequirementProvider is null");
        this.encryptionInformationProvider = requireNonNull(encryptionInformationProvider, "encryptionInformationProvider is null");
        this.partitionSkippabilityChecker = requireNonNull(partitionSkippabilityChecker, "partitionSkippabilityChecker is null");
    }

    @Override
    public ConnectorSplitSource getSplits(
            ConnectorTransactionHandle transaction,
            ConnectorSession session,
            ConnectorTableLayoutHandle layoutHandle,
            SplitSchedulingContext splitSchedulingContext)
    {
        HiveTableLayoutHandle layout = (HiveTableLayoutHandle) layoutHandle;
        SchemaTableName tableName = layout.getSchemaTableName();

        // get table metadata
        TransactionalMetadata metadata = hiveTransactionManager.get(transaction);
        if (metadata == null) {
            throw new PrestoException(HIVE_TRANSACTION_NOT_FOUND, format("Transaction not found: %s", transaction));
        }
        SemiTransactionalHiveMetastore metastore = metadata.getMetastore();
        MetastoreContext metastoreContext = new MetastoreContext(
                session.getIdentity(),
                session.getQueryId(),
                session.getClientInfo(),
                session.getClientTags(),
                session.getSource(),
                getMetastoreHeaders(session),
                isUserDefinedTypeEncodingEnabled(session),
                metastore.getColumnConverterProvider(),
                session.getWarningCollector(),
                session.getRuntimeStats());
        Table table = layout.getTable(metastore, metastoreContext);

        if (!isOfflineDataDebugModeEnabled(session)) {
            // verify table is not marked as non-readable
            String tableNotReadable = table.getParameters().get(OBJECT_NOT_READABLE);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Retry the query from the beginning so a fresh transaction handle is created.
  2. Check for coordinator restarts/failover around the time of the failure and ensure query state is not being reused.
  3. Verify clients are not caching or reusing split sources/transaction handles across queries.
  4. If recurring, investigate transaction manager cleanup/TTL settings and coordinator stability.
Defensive patterns

Strategy: retry

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: Long-running query outliving transaction cleanup; coordinator failover while a Hive scan is open; replaying a cached split source against a restarted server.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/400bf8285055f60c. Report an issue: GitHub.