yiisoft/yii2 · error · yii\console\Exception

The version argument must be either a timestamp (e.g. 101129

Error message

The version argument must be either a timestamp (e.g. 101129_185401)
or the full name of a migration (e.g. m101129_185401_create_user_table)
or the full name of a namespaced migration (e.g. app\migrations\M101129185401CreateUserTable).

What it means

Error "The version argument must be either a timestamp (e.g. 101129_185401) or the full name of a migration (e.g. m101129_185401_create_user_table) or the full name of a namespaced migration (e.g. app\migrations\M101129185401CreateUserTable)." thrown in yiisoft/yii2.

Source

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

     * yii migrate/mark m000000_000000_base # reset the complete migration history
     * ```
     *
     * @param string $version the version at which the migration history should be marked.
     * This can be either the timestamp or the full name of the migration.
     * You may specify the name `m000000_000000_base` to set the migration history to a
     * state where no migration has been applied.
     * @return int CLI exit code
     * @throws Exception if the version argument is invalid or the version cannot be found.
     */
    public function actionMark($version)
    {
        $originalVersion = $version;
        if (($namespaceVersion = $this->extractNamespaceMigrationVersion($version)) !== false) {
            $version = $namespaceVersion;
        } elseif (($migrationName = $this->extractMigrationVersion($version)) !== false) {
            $version = $migrationName;
        } elseif ($version !== static::BASE_MIGRATION) {
            throw new Exception("The version argument must be either a timestamp (e.g. 101129_185401)\nor the full name of a migration (e.g. m101129_185401_create_user_table)\nor the full name of a namespaced migration (e.g. app\\migrations\\M101129185401CreateUserTable).");
        }

        // try mark up
        $migrations = $this->getNewMigrations();
        foreach ($migrations as $i => $migration) {
            if (strpos($migration, $version) === 0) {
                if ($this->confirm("Set migration history at $originalVersion?")) {
                    for ($j = 0; $j <= $i; ++$j) {
                        $this->addMigrationHistory($migrations[$j]);
                    }
                    $this->stdout("The migration history is set at $originalVersion.\nNo actual migration was performed.\n", Console::FG_GREEN);
                }

                return ExitCode::OK;
            }
        }

        // try mark down

View on GitHub (pinned to 66f00d18a2)

When it happens

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