prestodb/presto · error · PrestoException
ICEBERG_TRANSACTION_CONFLICT_ERROR
ICEBERG_TRANSACTION_CONFLICT_ERROR
Error message
cannot be called within a transaction (use autocommit mode) in Iceberg connector.
What it means
Thrown by IcebergAbstractMetadata.shouldRunInAutoCommitTransaction when a statement that only supports autocommit execution (e.g. certain materialized view or table-maintenance operations) is issued inside an explicit multi-statement transaction. The Iceberg connector cannot run these operations within a user transaction.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:2893
.commit();
}
catch (RuntimeException e) {
throw new PrestoException(ICEBERG_INCOMPATIBLE_COLUMN_TYPE, "Failed to set column type: " + firstNonNull(e.getMessage(), e), e);
}
}
protected void openCreateTableTransaction(SchemaTableName tableName, Transaction transaction)
{
transactionContext.registerTransaction(tableName, transaction);
}
/**
* Check and ensure that the specified statement can only run in a transaction with autocommit context set to true.
* */
protected void shouldRunInAutoCommitTransaction(String statement)
{
if (!transactionContext.isAutoCommitContext()) {
throw new PrestoException(ICEBERG_TRANSACTION_CONFLICT_ERROR, statement + " cannot be called within a transaction (use autocommit mode) in Iceberg connector.");
}
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Run the statement outside any explicit transaction: COMMIT/ROLLBACK the current transaction first, then execute in autocommit mode
- Ensure the client/session has autocommit enabled (e.g. remove START TRANSACTION around the DDL)
- Restructure application logic so this Iceberg operation is executed as a standalone statement
Example fix
// before START TRANSACTION; CREATE MATERIALIZED VIEW mv AS SELECT ...; COMMIT; // after -- execute directly, autocommit on CREATE MATERIALIZED VIEW mv AS SELECT ...;
Defensive patterns
Strategy: validation
Validate before calling
// in client code, ensure autocommit before running Iceberg DDL
if (connection.getTransactionIsolation() != TRANSACTION_NONE && !connection.getAutoCommit()) {
throw new IllegalStateException("Commit/rollback the transaction before running this Iceberg statement");
} Try / catch
try { stmt.execute(ddl); } catch (PrestoException e) { if ("ICEBERG_TRANSACTION_CONFLICT_ERROR".equals(e.getErrorCode().getName())) { connection.setAutoCommit(true); /* re-run */ } else throw e; } Prevention
- Never wrap Iceberg-restricted DDL (e.g. materialized view ops) in START TRANSACTION blocks
- Keep autocommit enabled in ORM/framework-managed sessions for these statements
- Document which connector operations require autocommit in team runbooks
When it happens
Trigger: Executing a restricted statement (the operation name is prepended to the message) while inside START TRANSACTION ... without autocommit, i.e. transactionContext.isAutoCommitContext() is false.
Common situations: Wrapping CREATE/DROP MATERIALIZED VIEW or similar Iceberg DDL in an explicit transaction in a session or tool that keeps a transaction open; ORM/framework-managed sessions with autocommit disabled.
Related errors
- dropping a table added/modified in the same transaction is n
- HIVE_METASTORE_ERROR
- NOT_FOUND
- ALREADY_EXISTS
- INVALID_TABLE_PROPERTY
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/ac379d5fb5160193.
Report an issue: GitHub.