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),
 the full name of a migration (e.g. m101129_185401_create_user_table),
 the full namespaced name of a migration (e.g. app\migrations\M101129185401CreateUserTable),
 a UNIX timestamp (e.g. 1392853000), or a datetime string parseable
by the strtotime() function (e.g. 2014-02-15 13:00:50).

What it means

Error "The version argument must be either a timestamp (e.g. 101129_185401), the full name of a migration (e.g. m101129_185401_create_user_table), the full namespaced name of a migration (e.g. app\migrations\M101129185401CreateUserTable), a UNIX timestamp (e.g. 1392853000), or a datetime string parseable by the strtotime() function (e.g. 2014-02-15 13:00:50)." thrown in yiisoft/yii2.

Source

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

     *
     * @param string $version either the version name or the certain time value in the past
     * that the application should be migrated to. This can be either the timestamp,
     * the full name of the migration, the UNIX timestamp, or the parseable datetime
     * string.
     * @throws Exception if the version argument is invalid.
     */
    public function actionTo($version)
    {
        if (($namespaceVersion = $this->extractNamespaceMigrationVersion($version)) !== false) {
            return $this->migrateToVersion($namespaceVersion);
        } elseif (($migrationName = $this->extractMigrationVersion($version)) !== false) {
            return $this->migrateToVersion($migrationName);
        } elseif ((string) (int) $version == $version) {
            return $this->migrateToTime($version);
        } elseif (($time = strtotime($version)) !== false) {
            return $this->migrateToTime($time);
        } else {
            throw new Exception("The version argument must be either a timestamp (e.g. 101129_185401),\n the full name of a migration (e.g. m101129_185401_create_user_table),\n the full namespaced name of a migration (e.g. app\\migrations\\M101129185401CreateUserTable),\n a UNIX timestamp (e.g. 1392853000), or a datetime string parseable\nby the strtotime() function (e.g. 2014-02-15 13:00:50).");
        }
    }

    /**
     * Modifies the migration history to the specified version.
     *
     * No actual migration will be performed.
     *
     * ```
     * yii migrate/mark 101129_185401                        # using timestamp
     * yii migrate/mark m101129_185401_create_user_table     # using full name
     * yii migrate/mark app\migrations\M101129185401CreateUser # using full namespace name
     * 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

View on GitHub (pinned to 66f00d18a2)

When it happens

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