{"record":{"id":"676d5a633332e5d8","repo":"yiisoft/yii2","slug":"failed-to-commit-transaction-transaction-was-inac","errorCode":null,"errorMessage":"Failed to commit transaction: transaction was inactive.","messagePattern":"Failed to commit transaction: transaction was inactive\\.","errorType":"exception","errorClass":"yii\\db\\Exception","httpStatus":null,"severity":"error","filePath":"framework/db/Transaction.php","lineNumber":160,"sourceCode":"            // make sure the transaction wasn't autocommitted\n            if ($this->db->pdo->inTransaction()) {\n                $schema->createSavepoint('LEVEL' . $this->_level);\n            }\n        } else {\n            Yii::info('Transaction not started: nested transaction not supported', __METHOD__);\n            throw new NotSupportedException('Transaction not started: nested transaction not supported.');\n        }\n        $this->_level++;\n    }\n\n    /**\n     * Commits a transaction.\n     * @throws Exception if the transaction is not active\n     */\n    public function commit()\n    {\n        if (!$this->getIsActive()) {\n            throw new Exception('Failed to commit transaction: transaction was inactive.');\n        }\n\n        $this->_level--;\n        if ($this->_level === 0) {\n            Yii::debug('Commit transaction', __METHOD__);\n            // make sure the transaction wasn't autocommitted\n            if ($this->db->pdo->inTransaction()) {\n                $this->db->pdo->commit();\n            }\n            $this->db->trigger(Connection::EVENT_COMMIT_TRANSACTION);\n            return;\n        }\n\n        $schema = $this->db->getSchema();\n        if ($schema->supportsSavepoint()) {\n            Yii::debug('Release savepoint ' . $this->_level, __METHOD__);\n            // make sure the transaction wasn't autocommitted\n            if ($this->db->pdo->inTransaction()) {","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/Transaction.php#L142-L178","documentation":"Error \"Failed to commit transaction: transaction was inactive.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/db/Transaction.php:160 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}