Exception message in subprocess doesn't say which property in the subprocess was affected

Created on 8 November 2023, 7 months ago
Updated 9 November 2023, 7 months ago

Problem/Motivation

I am getting this error:

> global_block_content:field_bi_gds_header_meganav:sub_process: extract: Input should be an array, instead it was of type 'NULL'

This is the relevant process mapping in the migration:

  field_bi_gds_header_meganav:
    plugin: sub_process
    source: field_bi_gds_header_meganav
    process:
      target_id:
        -
          plugin: migration_lookup
          migration: market_paragraph
          source: target_id
        -
          plugin: extract
          index:
            - 0
      target_revision_id:
        -
          plugin: migration_lookup
          migration: market_paragraph
          source: target_id
        -
          plugin: extract
          index:
            - 1

The error message is ambiguous, because there is an 'extract' in both target_id and target_revision_id.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated about 4 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • πŸ‡¬πŸ‡§United Kingdom joachim

    The destination property is added to the exception message in import():

            catch (MigrateException $e) {
              $this->getIdMap()->saveIdMapping($row, [], $e->getStatus());
              $msg = sprintf("%s:%s:%s", $this->migration->getPluginId(), $destination_property_name, $e->getMessage());
              $this->saveMessage($msg, $e->getLevel());
              $save = FALSE;
            }
    

    But SubProcess calls processRow().

    I *think* we can fix this by adding the same handling in processRow() -- that is not called by the main import process AFAICT.

  • @joachim opened merge request.
  • Status changed to Needs review 7 months ago
  • πŸ‡¬πŸ‡§United Kingdom joachim
  • Status changed to Needs work 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thanks for reporting! Could we get a test case showing the issue or something testing the new exception.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    I'm adding tests here: πŸ“Œ Add kernel tests for prefixing of migrate process errors Needs review .

Production build 0.69.0 2024