{"record":{"id":"730af75f89ad8ae5","repo":"prestodb/presto","slug":"invalid-transaction-mode","errorCode":"INVALID_TRANSACTION_MODE","errorMessage":"Multiple transaction isolation levels specified","messagePattern":"Multiple transaction isolation levels specified","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/StartTransactionTask.java","lineNumber":79,"sourceCode":"                isolationLevel.orElse(TransactionManager.DEFAULT_ISOLATION),\n                readOnly.orElse(TransactionManager.DEFAULT_READ_ONLY),\n                false);\n\n        stateMachine.setStartedTransactionId(transactionId);\n\n        // Since the current session does not contain this new transaction ID, we need to manually mark it as inactive\n        // when this statement completes.\n        transactionManager.trySetInactive(transactionId);\n\n        return immediateFuture(null);\n    }\n\n    private static Optional<IsolationLevel> extractIsolationLevel(StartTransaction startTransaction)\n    {\n        if (startTransaction.getTransactionModes().stream()\n                .filter(Isolation.class::isInstance)\n                .count() > 1) {\n            throw new SemanticException(INVALID_TRANSACTION_MODE, startTransaction, \"Multiple transaction isolation levels specified\");\n        }\n\n        return startTransaction.getTransactionModes().stream()\n                .filter(Isolation.class::isInstance)\n                .map(Isolation.class::cast)\n                .map(Isolation::getLevel)\n                .map(StartTransactionTask::convertLevel)\n                .findFirst();\n    }\n\n    private static Optional<Boolean> extractReadOnly(StartTransaction startTransaction)\n    {\n        if (startTransaction.getTransactionModes().stream()\n                .filter(TransactionAccessMode.class::isInstance)\n                .count() > 1) {\n            throw new SemanticException(INVALID_TRANSACTION_MODE, startTransaction, \"Multiple transaction read modes specified\");\n        }\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/StartTransactionTask.java#L61-L97","documentation":"Validation inside extractIsolationLevel, which scans the characteristics of a START TRANSACTION statement: more than one ISOLATION LEVEL clause was supplied (e.g. 'START TRANSACTION ISOLATION LEVEL READ COMMITTED, ISOLATION LEVEL SERIALIZABLE'), so the isolation level is ambiguous.","triggerScenarios":"START TRANSACTION containing two or more Isolation transaction modes, e.g. START TRANSACTION ISOLATION LEVEL READ COMMITTED, ISOLATION LEVEL SERIALIZABLE — extractIsolationLevel() counts >1 Isolation instances.","commonSituations":"Duplicated clauses from query generation bugs, templated SQL concatenating transaction-mode fragments, copy-paste mistakes in scripts.","solutions":["Keep a single ISOLATION LEVEL clause in START TRANSACTION.","Fix the SQL builder/template so transaction modes are not concatenated twice.","Validate the statement text before execution in generated-SQL pipelines."],"exampleFix":"-- before\nSTART TRANSACTION ISOLATION LEVEL READ COMMITTED, ISOLATION LEVEL SERIALIZABLE;\n-- after\nSTART TRANSACTION ISOLATION LEVEL SERIALIZABLE;","handlingStrategy":"validation","validationCode":"// count isolation clauses before execution\nint n = countMatches(sql, \"ISOLATION LEVEL\"); if (n > 1) reject(sql);","typeGuard":null,"tryCatchPattern":"// catch SemanticException with code INVALID_TRANSACTION_MODE and message 'Multiple transaction isolation levels specified'; fix SQL and re-run","preventionTips":["Emit each transaction mode at most once in SQL generators","Unit-test generated START TRANSACTION statements","Deduplicate transaction-mode tokens when composing SQL"],"tags":["transactions","sql-syntax","validation"],"backgroundTag":"invalid-transaction-mode","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"}