yiisoft/yii2 · error · yii\base\InvalidCallException
DB Connection is not active.
Error message
DB Connection is not active.
What it means
Error "DB Connection is not active." thrown in yiisoft/yii2.
Source
Thrown at framework/db/Schema.php:373
public function findUniqueIndexes($table)
{
throw new NotSupportedException(get_class($this) . ' does not support getting unique indexes information.');
}
/**
* Returns the ID of the last inserted row or sequence value.
* @param string $sequenceName name of the sequence object (required by some DBMS)
* @return string the row ID of the last row inserted, or the last value retrieved from the sequence object
* @throws InvalidCallException if the DB connection is not active
* @see https://www.php.net/manual/en/function.PDO-lastInsertId.php
*/
public function getLastInsertID($sequenceName = '')
{
if ($this->db->isActive) {
return $this->db->pdo->lastInsertId($sequenceName === '' ? null : $this->quoteTableName($sequenceName));
}
throw new InvalidCallException('DB Connection is not active.');
}
/**
* @return bool whether this DBMS supports [savepoint](https://en.wikipedia.org/wiki/Savepoint).
*/
public function supportsSavepoint()
{
return $this->db->enableSavepoint;
}
/**
* Creates a new savepoint.
* @param string $name the savepoint name
*/
public function createSavepoint($name)
{
$this->db->createCommand("SAVEPOINT $name")->execute();
}View on GitHub (pinned to 66f00d18a2)
When it happens
Trigger: Thrown at framework/db/Schema.php:373 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/c70f1dfad9ba7d8b.
Report an issue: GitHub.