-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
In Craft it's possible to create drafts where the title is null, even when the title is required. When a draft with a null title is included in a migration an error is thrown when applying it.
Also, if the draft does have a title, the migration is successful, but the draft is no longer a draft (technically a different bug).
JSON with null title draft, field content removed.
{"content":{"entries":[{"slug":"__temp_xzbagyepnbtzflrxkurudmzeqlkjlhvvrkhg","section":"pages","sites":{"demo":{"slug":"__temp_xzbagyepnbtzflrxkurudmzeqlkjlhvvrkhg","section":"pages","enabled":true,"site":"demo","enabledForSite":true,"postDate":{"date":"2025-10-16 16:06:30.000000","timezone_type":3,"timezone":"Pacific/Auckland"},"expiryDate":null,"title":null,"entryType":"page","uid":"50738384-f04c-4702-8d1e-ef16936eb38b","author":"Bryce","fields":{}}}}]}}
Stack Trace of "*Title* cannot be blank" error
2025-10-16 16:07:31 [migration-assistant-errors.ERROR] [dgrigg\migrationassistant\services\Migrations::import] Could not save the __temp_xzbagyepnbtzflrxkurudmzeqlkjlhvvrkhg entry. {"memory":4317200}
2025-10-16 16:07:31 [migration-assistant-errors.ERROR] [dgrigg\migrationassistant\services\Migrations::import] *Title* cannot be blank. {"memory":4317632}
2025-10-16 16:07:31 [migration-assistant-errors.ERROR] [dgrigg\migrationassistant\services\Migrations::runMigrations] Migration failed. {"memory":4228648}
2025-10-16 16:07:31 [migration-assistant-errors.ERROR] [dgrigg\migrationassistant\services\Migrations::runMigrations] An error occurred while executing the "craft\contentmigrations\m251016_160652_migration_entry_temp_xzbagyepnbtzflrxkurudmzeqlkjlhvvrkhg migration. {"memory":4228864}
2025-10-16 16:07:31 [migration-assistant-errors.ERROR] [dgrigg\migrationassistant\services\Migrations::runMigrations] craft\errors\MigrationException: An error occurred while executing the "craft\contentmigrations\m251016_160652_migration_entry_temp_xzbagyepnbtzflrxkurudmzeqlkjlhvvrkhg migration. in /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php:253
Stack trace:
#0 /var/www/html/vendor/dgrigg/craft-migration-assistant/src/services/Migrations.php(200): craft\db\MigrationManager->migrateUp()
#1 /var/www/html/vendor/dgrigg/craft-migration-assistant/src/controllers/MigrationsController.php(79): dgrigg\migrationassistant\services\Migrations->runMigrations()
#2 [internal function]: dgrigg\migrationassistant\controllers\MigrationsController->actionRun()
#3 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#4 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#5 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(360): yii\base\Module->runAction()
#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(659): craft\web\Application->runAction()
#8 /var/www/html/vendor/craftcms/cms/src/web/Application.php(322): craft\web\Application->_processActionRequest()
#9 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#10 /var/www/html/web/index.php(12): yii\base\Application->run()
#11 {main} {"memory":4229080,"exception":"[object] (craft\\errors\\MigrationException(code: 0): An error occurred while executing the \"craft\\contentmigrations\\m251016_160652_migration_entry_temp_xzbagyepnbtzflrxkurudmzeqlkjlhvvrkhg migration. at /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php:253)"}
2025-10-16 16:07:31 [migration-assistant-errors.ERROR] [dgrigg\migrationassistant\controllers\MigrationsController::actionRun] yii\base\ErrorException: foreach() argument must be of type array|object, string given in /var/www/html/vendor/dgrigg/craft-migration-assistant/src/controllers/MigrationsController.php:88
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(115): yii\base\ErrorHandler->handleError()
#1 /var/www/html/vendor/dgrigg/craft-migration-assistant/src/controllers/MigrationsController.php(88): craft\web\ErrorHandler->handleError()
#2 [internal function]: dgrigg\migrationassistant\controllers\MigrationsController->actionRun()
#3 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#4 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#5 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(360): yii\base\Module->runAction()
#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(659): craft\web\Application->runAction()
#8 /var/www/html/vendor/craftcms/cms/src/web/Application.php(322): craft\web\Application->_processActionRequest()
#9 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#10 /var/www/html/web/index.php(12): yii\base\Application->run()
#11 {main} {"memory":4562936,"exception":"[object] (yii\\base\\ErrorException(code: 2): foreach() argument must be of type array|object, string given at /var/www/html/vendor/dgrigg/craft-migration-assistant/src/controllers/MigrationsController.php:88)"}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels