yiisoft/yii2 · error · yii\db\Exception
Failed to set isolation level: transaction was inactive.
Error message
Failed to set isolation level: transaction was inactive.
What it means
Error "Failed to set isolation level: transaction was inactive." thrown in yiisoft/yii2.
Source
Thrown at framework/db/Transaction.php:235
}
}
/**
* Sets the transaction isolation level for this transaction.
*
* This method can be used to set the isolation level while the transaction is already active.
* However this is not supported by all DBMS so you might rather specify the isolation level directly
* when calling [[begin()]].
* @param string $level The transaction isolation level to use for this transaction.
* This can be one of [[READ_UNCOMMITTED]], [[READ_COMMITTED]], [[REPEATABLE_READ]] and [[SERIALIZABLE]] but
* also a string containing DBMS specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`.
* @throws Exception if the transaction is not active
* @see https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
*/
public function setIsolationLevel($level)
{
if (!$this->getIsActive()) {
throw new Exception('Failed to set isolation level: transaction was inactive.');
}
Yii::debug('Setting transaction isolation level to ' . $level, __METHOD__);
$this->db->getSchema()->setTransactionIsolationLevel($level);
}
/**
* @return int The current nesting level of the transaction.
* @since 2.0.8
*/
public function getLevel()
{
return $this->_level;
}
}
View on GitHub (pinned to 66f00d18a2)
When it happens
Trigger: Thrown at framework/db/Transaction.php:235 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17).
Data as JSON: /api/errors/76ae7a1b9e2671a9.
Report an issue: GitHub.