What way to debug ignored items in Drupal 8 migration

Once you've identified the row, as described above, it's sometimes still hard to find. My case it was triggering updates on a previously imported entity, which was then throwing a row skip exception.

You can work out what is throwing the exception by watching the while($source->valid()) loop in MigrateExecutable::import(). It's around line 198 (at the moment). There it has a try-catch which will catch exceptions telling it to skip the row.

If you have a debugger set a watch for your skipped ID and then get the line and file triggering it from the exception.

If you don't, it's worth getting one, but you can add an if based on the sourceIdValues and print the $e->getLine() $e->getFile() to get where the exception was thrown.


I'm not sure if there's a "more proper" way to investigate what's going on with individual migration jobs, but I just view my migrate_* database tables. It doesn't tell me the reason why a specific row failed, but at least I'll be able to identify exactly which ones I need to investigate.

In the migrate_* table that matches the migration job that you're interested in, look for lines where the destid1 value is NULL.


You are migrating from Drupal 7 to Drupal 8 and you have ignored items after you run a migration. This leads to the very important question of which ones were ignored?

What you see

[notice] Processed 632 items (630 created, 0 updated, 0 failed, 2 ignored) - done with 'node_form'

The above is what I will use in my examples.

What you want to know

What are the items ignored!? For this we can look into the database. I assume you have access to a console...

The migrate_map_migration_name table in your database will give you the information you need. There will be a column named source_row_status. The value of 2 equals the status of ignored. So run the following MySQL command:

SELECT * FROM `migrate_map_node_form` WHERE source_row_status = 2;

The sourceid1 column of the returned rows will contain the id of the item that was ignored.

Example output:

+-------------------------------------------------------+-----------+---------+-------------------+-------------------+---------------+------+
| source_ids_hash                                       | sourceid1 | destid1 | source_row_status | source_row_status | last_imported | hash |
+-------------------------------------------------------+-----------+---------+-------------------+-------------------+---------------+------+
| 8530eb5d63ad4cfea47134a28e3339e089f639164d218287c3... | 10931     | NULL    | 2                 | 0                 | 0             |      |
+-------------------------------------------------------+-----------+---------+-------------------+-------------------+---------------+------+
| ddd550e747c2a26a2a5058d49be0e146616fd5c45f6bef88f3... | 11656     | NULL    | 2                 | 0                 | 0             |      |
+-------------------------------------------------------+-----------+---------+-------------------+-------------------+---------------+------+