I am trying to write custom migrations to migrate my Drupal 7 website to Drupal 8. I am currently using Drupal 8.6.7 and Drupal 7.61 for a copy of the production website.

So far I have set up the D8 website with composer (docroot is path/to/web) (https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies )

I have always used Drush for maintenance actions on the D7 site and I am using Drush 9 for most of the actions including the migrations on the D8 site.

I have installed the most relevant modules in the D8 site so that I can start the migration, most notably all the D8 equivalents of the modules I used in the text formats/filters as well as migrate_plus, migrate_tools and migrate_upgrade.

The migration files are generated with the Drush command:

drush @dev migrate-upgrade "$LEGACYDB" "$LEGACYURL" --configure-only --migration-prefix=osn_custom_

So far I have successfully migrated the users and their roles so I have some knowledge on how migrations work.

The problem I am currently working on is the migration of a custom content type called 'classified'. This type has a default Drupal 7 body field and a field 'field_image'. So quite ordinary.

When I use the default generated migration file, it looks like everything is migrated, but the text is not visible. After research I found this is caused by the fact that the input format is set to the D7 code (in my case 2 aka 'full html') while there is no filter code in D8 that is called '2'. (src: https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#d7_to_d8 ).

I decided that I might as well convert 2 to 'basic html' and use the D8 configuration and not migrate the D7 text filters at all.

I created a migration lookup plugin with a static map that converts all D7 codes to the preferred D8 code. It might work well, but I am running into the problem that I can't get the migration plugin to work with the migration of the 'classified' migration configuration. So I decided to simplify it and set the format to a default value 'basic_html'.

Here is what I tried in the migrate_plus.migration.osn_custom_d7_node_classified.yml The code snippets below only show the body configuration, because the other field configurations are generated with the drush command and not altered.

body: body

the default. Content is migrated, input format is set to '2'.

According to this: https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins/migrate-process-overview#nested

and this: https://medium.com/drupal-stories-an-insiders-view/migrate-api-custom-drupal-to-drupal-migration-3bab05da4686

and this: https://www.phase2technology.com/blog/drupal-8-migrations

it should be done like this:

    plugin: default_value
    default_value: basic_html

  'body/value': body

However, this results in the following error:

[error] InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in /path/to/dev/web/core/lib/Drupal/Core/Database/Connection.php).

[error] Placeholders must have a trailing [] if they are to be expanded with an array of values. (/path/to/dev/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:783)

I have no clue what is wrong and what I should do instead. I also don't know how to debug this to find out what it's expecting.

Can someone please give me some pointers?

  • Try to take a look here, drupal.org/project/drupal/issues/2639556
    – user72672
    Jan 19, 2019 at 15:47
  • Yes! That works. Thank you @Jdrupal ! I will answer this question to help others avoid spending days figuring this out.
    – hepabolu
    Jan 19, 2019 at 19:14
  • I’m glad to hear it worked :)
    – user72672
    Jan 19, 2019 at 19:27

1 Answer 1


Thanks to @Jdrupal I finally found the solution in this link.

    plugin: sub_process
    source: body
      value: value
        plugin: default_value
        default_value: basic_html

(sorry I can't seem to get the mention appropriately formatted)

  • This worked for me too (thanks!), with one change. According to the d.o Migrate Process Plugins documentation, iterator has been deprecated and replaced with sub_process. Feb 13, 2019 at 22:02
  • Thanks. I kept finding all sorts of other methods, but this is what worked for me.
    – MrPeanut
    Apr 3, 2019 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.