Command drush migrate:import --all fails first run

Created on 5 May 2025, 10 days ago

Problem/Motivation

I am trying to document the complete process of using a DDEV WordPress instance to generate example content, as well as import it into a DDEV Drupal instance in How to generate WordPress content and import into Drupal β†’ .

I can almost import everything with drush migrate:import --all, but get an error, and need to run the import command twice ...

But after the second run, everything is then imported, which is really great -- It works, and it's awesome to be able to export and import WordPress content such as HTML, images and tags into Drupal :)

I am attaching the export file, in case it helps.

Debian 12 and latest DDEV

$ drush st
Drupal version   : 11.1.6                                     
PHP version      : 8.3.19                                     
Drush version    : 13.6.0.0                                   

PS. It seems odd that there are two migration groups (Default and the user created one) ... but maybe there's a good reason for that?

Steps to reproduce

Generate example content, export it, import with Drush, and get an error in the first run:

user:~/dev/drupal$ drush migrate:status
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------- 
  Group                                Migration ID                    Status   Total   Imported   Unprocessed   Message Count   Last Imported  
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------- 
  Default (default)                    wordpress_attachments           Idle     0       0          0             0                              
  Default (default)                    wordpress_authors               Idle     0       0          0             0                              
  Default (default)                    wordpress_categories            Idle     0       0          0             0                              
  Default (default)                    wordpress_comment               Idle     0       0          0             0                              
  Default (default)                    wordpress_content               Idle     0       0          0             0                              
  Default (default)                    wordpress_tags                  Idle     0       0          0             0                              
                                                                                                                                                
  Imports from WordPress site (5may)   wp_5maywordpress_authors        Idle     5       0          5             0                              
  Imports from WordPress site (5may)   wp_5maywordpress_attachments    Idle     7       0          7             0                              
  Imports from WordPress site (5may)   wp_5maywordpress_tags           Idle     10      0          10            0                              
  Imports from WordPress site (5may)   wp_5maywordpress_content_post   Idle     12      0          12            0                              
  Imports from WordPress site (5may)   wp_5maywordpress_comment_post   Idle     1       0          1             0                              
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------- 

user:~/dev/drupal$ drush migrate:import --all -vvv
 [preflight] Config paths: /var/www/html/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /var/www/html/web/drush/sites,/var/www/html/drush/sites
 [preflight] Commandfile search paths: /var/www/html/vendor/drush/drush/src
 [debug] Bootstrap further to find migrate:import [0.31 sec, 2.89 MB]
 [debug] Trying to bootstrap as far as we can [0.31 sec, 2.89 MB]
 [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.31 sec, 2.89 MB]
 [info] Change working directory to /var/www/html/web [0.31 sec, 2.89 MB]
 [info] Initialized Drupal 11.1.6 root directory at /var/www/html/web [0.31 sec, 2.89 MB]
 [info] Drush bootstrap phase: bootstrapDrupalSite() [0.31 sec, 2.96 MB]
 [debug] Could not find a Drush config file at sites/default/drush.yml. [0.31 sec, 3.02 MB]
 [info] Initialized Drupal site drupal.ddev.site at sites/default [0.31 sec, 3.02 MB]
 [info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.31 sec, 3.02 MB]
 [info] Drush bootstrap phase: bootstrapDrupalDatabase() [0.33 sec, 3.22 MB]
 [info] Successfully connected to the Drupal database. [0.33 sec, 3.22 MB]
 [info] Drush bootstrap phase: bootstrapDrupalFull() [0.33 sec, 3.22 MB]
 [debug] Start bootstrap of the Drupal Kernel. [0.33 sec, 3.22 MB]
 [debug] Finished bootstrap of the Drupal Kernel. [0.37 sec, 6.55 MB]
 [debug] Loading drupal module drush commands & etc. [0.37 sec, 6.55 MB]
 [debug] Found drush.services.yml for migrate_tools Drush commands [0.37 sec, 6.56 MB]
 [debug] Found drush.services.yml for token Drush commands [0.37 sec, 6.56 MB]
 [debug] Add a commandfile class: Drupal\migrate_tools\Drush\Commands\MigrateToolsCommands [0.4 sec, 7.83 MB]
 [debug] Add a commandfile class: Drupal\token\Drush\Commands\TokenCommands [0.41 sec, 7.88 MB]
 [debug] Add a commandfile class: Drupal\pathauto\Commands\PathautoCommands [0.41 sec, 7.88 MB]
 [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find migrate:import again. [0.49 sec, 9.86 MB]
 [info] Starting bootstrap to none [0.49 sec, 9.9 MB]
 [info] Drush bootstrap phase 0 [0.49 sec, 9.9 MB]
 [info] Try to validate bootstrap phase 0 [0.49 sec, 9.9 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.51 sec, 10.51 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_attachments' [0.54 sec, 11.74 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.54 sec, 11.74 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_authors' [0.54 sec, 11.91 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.54 sec, 11.91 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_categories' [0.55 sec, 12.09 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.55 sec, 12.09 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_comment' [0.55 sec, 12.26 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.55 sec, 12.26 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_content' [0.55 sec, 12.41 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.56 sec, 12.41 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_tags' [0.56 sec, 12.41 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.57 sec, 12.54 MB]
 [notice] Processed 5 items (4 created, 0 updated, 0 failed, 1 ignored) - done with 'wp_5maywordpress_authors' [0.64 sec, 14.43 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.64 sec, 14.42 MB]
 [notice] Processed 7 items (7 created, 0 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_attachments' [0.7 sec, 15.02 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.7 sec, 15.01 MB]
 [notice] Processed 10 items (10 created, 0 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_tags' [0.75 sec, 15.79 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [0.76 sec, 15.78 MB]
  1/12 [==>-------------------------]   8% < 1 sec/< 1 sec 18.0 MiB [info] basename(): Passing null to parameter #1 ($path) of type string is deprecated Callback.php:103 [0.81 sec, 17 MB]
 [info] strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated Callback.php:103 [0.81 sec, 17 MB]
  3/12 [=======>--------------------]  25% < 1 sec/< 1 sec 18.0 MiB [info] basename(): Passing null to parameter #1 ($path) of type string is deprecated Callback.php:103 [0.85 sec, 16.05 MB]
 [info] strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated Callback.php:103 [0.85 sec, 16.05 MB]
  5/12 [===========>----------------]  41% < 1 sec/< 1 sec 18.0 MiB [info] basename(): Passing null to parameter #1 ($path) of type string is deprecated Callback.php:103 [0.91 sec, 16.57 MB]
 [info] strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated Callback.php:103 [0.91 sec, 16.57 MB]
 [notice] Processed 12 items (10 created, 0 updated, 2 failed, 0 ignored) - done with 'wp_5maywordpress_content_post' [0.95 sec, 16.97 MB]

In MigrateToolsCommands.php line 1094:
                                                       
  [Exception]                                          
  wp_5maywordpress_content_post Migration - 2 failed.  
                                                       

Exception trace:
  at /var/www/html/web/modules/contrib/migrate_tools/src/Drush/Commands/MigrateToolsCommands.php:1094
 Drupal\migrate_tools\Drush\Commands\MigrateToolsCommands->executeMigration() at /var/www/html/web/modules/contrib/migrate_tools/src/Drush/Commands/MigrateToolsCommands.php:483
 Drupal\migrate_tools\Drush\Commands\MigrateToolsCommands->import() at n/a:n/a
 call_user_func_array() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:276
 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:175
 Consolidation\AnnotatedCommand\CommandProcessor->process() at /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:387
 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:279
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1094
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:342
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->run() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:110
 Drush\Runtime\Runtime->doRun() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:40
 Drush\Runtime\Runtime->run() at /var/www/html/vendor/drush/drush/drush.php:140
 include() at /var/www/html/vendor/bin/drush.php:119


Failed to run drush migrate:import --all -vvv: exit status 1

user:~/dev/drupal$ drush migrate:status
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------------- 
  Group                                Migration ID                    Status   Total   Imported   Unprocessed   Message Count   Last Imported        
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------------- 
  Default (default)                    wordpress_attachments           Idle     0       0          0             0               2025-05-05 10:32:54  
  Default (default)                    wordpress_authors               Idle     0       0          0             0               2025-05-05 10:32:54  
  Default (default)                    wordpress_categories            Idle     0       0          0             0               2025-05-05 10:32:54  
  Default (default)                    wordpress_comment               Idle     0       0          0             0               2025-05-05 10:32:54  
  Default (default)                    wordpress_content               Idle     0       0          0             0               2025-05-05 10:32:54  
  Default (default)                    wordpress_tags                  Idle     0       0          0             0               2025-05-05 10:32:54  
                                                                                                                                                      
  Imports from WordPress site (5may)   wp_5maywordpress_authors        Idle     5       4          0             1               2025-05-05 10:32:54  
  Imports from WordPress site (5may)   wp_5maywordpress_attachments    Idle     7       8          -1            0               2025-05-05 10:32:54  
  Imports from WordPress site (5may)   wp_5maywordpress_tags           Idle     10      10         0             0               2025-05-05 10:32:54  
  Imports from WordPress site (5may)   wp_5maywordpress_content_post   Idle     12      10         0             2               2025-05-05 10:32:54  
  Imports from WordPress site (5may)   wp_5maywordpress_comment_post   Idle     1       0          1             0                                    
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------------- 

user:~/dev/drupal$ drush migrate:import --all -vvv
 [preflight] Config paths: /var/www/html/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /var/www/html/web/drush/sites,/var/www/html/drush/sites
 [preflight] Commandfile search paths: /var/www/html/vendor/drush/drush/src
 [debug] Bootstrap further to find migrate:import [0.89 sec, 2.89 MB]
 [debug] Trying to bootstrap as far as we can [0.89 sec, 2.89 MB]
 [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.89 sec, 2.89 MB]
 [info] Change working directory to /var/www/html/web [0.89 sec, 2.89 MB]
 [info] Initialized Drupal 11.1.6 root directory at /var/www/html/web [0.9 sec, 2.89 MB]
 [info] Drush bootstrap phase: bootstrapDrupalSite() [0.9 sec, 2.96 MB]
 [debug] Could not find a Drush config file at sites/default/drush.yml. [0.9 sec, 3.02 MB]
 [info] Initialized Drupal site drupal.ddev.site at sites/default [0.9 sec, 3.02 MB]
 [info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.9 sec, 3.02 MB]
 [info] Drush bootstrap phase: bootstrapDrupalDatabase() [0.92 sec, 3.22 MB]
 [info] Successfully connected to the Drupal database. [0.92 sec, 3.22 MB]
 [info] Drush bootstrap phase: bootstrapDrupalFull() [0.92 sec, 3.22 MB]
 [debug] Start bootstrap of the Drupal Kernel. [0.92 sec, 3.22 MB]
 [debug] Finished bootstrap of the Drupal Kernel. [0.96 sec, 6.55 MB]
 [debug] Loading drupal module drush commands & etc. [0.96 sec, 6.55 MB]
 [debug] Found drush.services.yml for migrate_tools Drush commands [0.96 sec, 6.56 MB]
 [debug] Found drush.services.yml for token Drush commands [0.96 sec, 6.56 MB]
 [debug] Add a commandfile class: Drupal\migrate_tools\Drush\Commands\MigrateToolsCommands [0.99 sec, 7.83 MB]
 [debug] Add a commandfile class: Drupal\token\Drush\Commands\TokenCommands [0.99 sec, 7.88 MB]
 [debug] Add a commandfile class: Drupal\pathauto\Commands\PathautoCommands [1 sec, 7.88 MB]
 [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find migrate:import again. [1.08 sec, 9.86 MB]
 [info] Starting bootstrap to none [1.08 sec, 9.9 MB]
 [info] Drush bootstrap phase 0 [1.08 sec, 9.9 MB]
 [info] Try to validate bootstrap phase 0 [1.08 sec, 9.9 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.1 sec, 10.51 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_attachments' [1.12 sec, 11.74 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.13 sec, 11.74 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_authors' [1.13 sec, 11.91 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.13 sec, 11.91 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_categories' [1.13 sec, 12.09 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.14 sec, 12.09 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_comment' [1.14 sec, 12.26 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.14 sec, 12.26 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_content' [1.14 sec, 12.41 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.14 sec, 12.41 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wordpress_tags' [1.14 sec, 12.41 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.16 sec, 12.54 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_authors' [1.16 sec, 12.59 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.17 sec, 12.58 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_attachments' [1.18 sec, 12.61 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.18 sec, 12.61 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_tags' [1.19 sec, 12.63 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.2 sec, 12.63 MB]
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_content_post' [1.21 sec, 12.7 MB]
 [debug] Calling Drupal\migrate_tools\MigrateExecutable::import() [1.22 sec, 12.7 MB]
 [info] strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated Callback.php:103 [1.24 sec, 13.13 MB]
 [notice] Processed 2 items (1 created, 1 updated, 0 failed, 0 ignored) - done with 'wp_5maywordpress_comment_post' [1.32 sec, 15.39 MB]

user:~/dev/drupal$ drush migrate:status
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------------- 
  Group                                Migration ID                    Status   Total   Imported   Unprocessed   Message Count   Last Imported        
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------------- 
  Default (default)                    wordpress_attachments           Idle     0       0          0             0               2025-05-05 10:33:01  
  Default (default)                    wordpress_authors               Idle     0       0          0             0               2025-05-05 10:33:01  
  Default (default)                    wordpress_categories            Idle     0       0          0             0               2025-05-05 10:33:01  
  Default (default)                    wordpress_comment               Idle     0       0          0             0               2025-05-05 10:33:01  
  Default (default)                    wordpress_content               Idle     0       0          0             0               2025-05-05 10:33:01  
  Default (default)                    wordpress_tags                  Idle     0       0          0             0               2025-05-05 10:33:01  
                                                                                                                                                      
  Imports from WordPress site (5may)   wp_5maywordpress_authors        Idle     5       4          0             0               2025-05-05 10:33:01  
  Imports from WordPress site (5may)   wp_5maywordpress_attachments    Idle     7       8          -1            0               2025-05-05 10:33:01  
  Imports from WordPress site (5may)   wp_5maywordpress_tags           Idle     10      10         0             0               2025-05-05 10:33:01  
  Imports from WordPress site (5may)   wp_5maywordpress_content_post   Idle     12      10         0             0               2025-05-05 10:33:01  
  Imports from WordPress site (5may)   wp_5maywordpress_comment_post   Idle     1       2          -1            0               2025-05-05 10:33:01  
 ------------------------------------ ------------------------------- -------- ------- ---------- ------------- --------------- --------------------- 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡©πŸ‡°Denmark ressa Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024