yiisoft/yii2 · error · yii\db\Exception
Failed to commit transaction: transaction was inactive.
Error message
Failed to commit transaction: transaction was inactive.
What it means
Error "Failed to commit transaction: transaction was inactive." thrown in yiisoft/yii2.
Source
Thrown at framework/db/Transaction.php:160
// make sure the transaction wasn't autocommitted
if ($this->db->pdo->inTransaction()) {
$schema->createSavepoint('LEVEL' . $this->_level);
}
} else {
Yii::info('Transaction not started: nested transaction not supported', __METHOD__);
throw new NotSupportedException('Transaction not started: nested transaction not supported.');
}
$this->_level++;
}
/**
* Commits a transaction.
* @throws Exception if the transaction is not active
*/
public function commit()
{
if (!$this->getIsActive()) {
throw new Exception('Failed to commit transaction: transaction was inactive.');
}
$this->_level--;
if ($this->_level === 0) {
Yii::debug('Commit transaction', __METHOD__);
// make sure the transaction wasn't autocommitted
if ($this->db->pdo->inTransaction()) {
$this->db->pdo->commit();
}
$this->db->trigger(Connection::EVENT_COMMIT_TRANSACTION);
return;
}
$schema = $this->db->getSchema();
if ($schema->supportsSavepoint()) {
Yii::debug('Release savepoint ' . $this->_level, __METHOD__);
// make sure the transaction wasn't autocommitted
if ($this->db->pdo->inTransaction()) {View on GitHub (pinned to 66f00d18a2)
When it happens
Trigger: Thrown at framework/db/Transaction.php:160 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/676d5a633332e5d8.
Report an issue: GitHub.