yiisoft/yii2 · error · yii\console\Exception

Unable to find the version '$originalVersion'.

Error message

Unable to find the version '$originalVersion'.

What it means

Error "Unable to find the version '$originalVersion'." thrown in yiisoft/yii2.

Source

Thrown at framework/console/controllers/BaseMigrateController.php:473

        // try mark down
        $migrations = array_keys($this->getMigrationHistory(null));
        $migrations[] = static::BASE_MIGRATION;
        foreach ($migrations as $i => $migration) {
            if (strpos($migration, $version) === 0) {
                if ($i === 0) {
                    $this->stdout("Already at '$originalVersion'. Nothing needs to be done.\n", Console::FG_YELLOW);
                } elseif ($this->confirm("Set migration history at $originalVersion?")) {
                    for ($j = 0; $j < $i; ++$j) {
                        $this->removeMigrationHistory($migrations[$j]);
                    }
                    $this->stdout("The migration history is set at $originalVersion.\nNo actual migration was performed.\n", Console::FG_GREEN);
                }

                return ExitCode::OK;
            }
        }

        throw new Exception("Unable to find the version '$originalVersion'.");
    }

    /**
     * Drops all tables and related constraints. Starts the migration from the beginning.
     *
     * ```
     * yii migrate/fresh
     * ```
     *
     * @since 2.0.13
     */
    public function actionFresh()
    {
        if (YII_ENV_PROD) {
            $this->stdout("YII_ENV is set to 'prod'.\nRefreshing migrations is not possible on production systems.\n");

            return ExitCode::OK;
        }

View on GitHub (pinned to 66f00d18a2)

When it happens

Trigger: Thrown at framework/console/controllers/BaseMigrateController.php:473 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/e58dd8f4a2acac31. Report an issue: GitHub.