Drupal\Core\Entity\EntityStorageException : Unable to apply data selector 'to_sid.target_id' at 'to_sid.target_id'

Created on 23 June 2025, 3 months ago

Since the last stable update version 2.1.1, when submit my node form containing actions button based on a workflow, I have the error Drupal\Core\Entity\EntityStorageException : Unable to apply data selector 'to_sid.target_id' at 'to_sid.target_id': Property target_id is unknown. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
The status value are not changing. Could you correct this please ? On version 2.0.0 this problem doesn't exist.
Thanks a lot

🐛 Bug report
Status

Active

Version

2.1

Component

Workflow Node API

Created by

🇫🇷France dcoppel

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

Comments & Activities

  • Issue created by @dcoppel
  • 🇳🇱Netherlands johnv

    I cannot reproduce.
    Where do you have the Workflow Transition form (on node view, edit, block, history)
    Did you run update.php?

  • 🇳🇱Netherlands johnv

    Dou you have custom code?

  • 🇫🇷France dcoppel

    Hi,
    I have the workflow transition in my edit node form with one action button by workflow state.
    I ran the update.php after update workflow module.
    I do not have custom code. I use some rules (with Rules module) based on transition change status to send some emails.
    I hope this help. If you need more informations please ask !
    Regards

  • 🇳🇱Netherlands johnv

    OK, I will uninstall, donwgrade, then upgrade again,

  • 🇳🇱Netherlands johnv

    I could reproduce.
    Please test v2.1.2 or v2.0.x-dev, run update.php, and report back. Reopen if needed.

  • 🇫🇷France dcoppel

    Hi, thanks for helping resolve this bug !
    Nevertheless, after install version 2.1.2, I still have exactly the same issue.

  • 🇳🇱Netherlands johnv

    Some debugging is needed.

    IMO this happens because of the change(s) between WorkflowTransition::baseField['to_sid'] and ['from_sid'] being a list_string or an entity_reference.

    I guess this still happens when you switch from 'action buttons' to 'select list'?

    Can you determine what is being saved?
    - the node/entity, or
    - the WorkflowTransition

    In WorkflowTransition::save(), or its more generic parent EntityBase::save() in one of the first lines, you should find the 'target_id'. Unset that, and see what happens.

  • 🇫🇷France dcoppel

    Hi,
    Sorry for delay but I was not available this last ten days !
    The issue still exist un the last 2.1.4 version.
    This error is happening when changing the state of the state field even in a select list.

    I don't know how to know if its comming from WorkflowTransition::save(), or its more generic parent EntityBase::save()...
    Thanks for your help.

  • 🇳🇱Netherlands johnv

    There must be an update not executed.

    what does the following report say: /drupal/admin/reports/status#error

    please apply the patch and see what happens.

  • 🇳🇱Netherlands johnv

    Are you using an Action, by any chance?

  • 🇫🇷France dcoppel

    It's strange... I tried to reproduce the issue with 2.1.4 version today and there is no problem.
    I keep you inform if I arrive to reproduce this issue.

  • 🇫🇷France dcoppel

    In fact, my webcache site was the trouble !!! After restart apache service, the problem appear again.
    I put the patch that you gave and the same error appears.
    I hope this help !
    Thanks for your help.

  • 🇫🇷France dcoppel

    I just tried version 2.1.5 and there is still the same issue. I put version 2.0.0 that is ok for me...

  • 🇳🇱Netherlands johnv

    Hmm, we do not get any further.
    You save the entity, then set the field name and create a transition.
    It seems the field is not defined yet in the entity. Can you find out in which lin of code the error occurs?
    I could/should add exceptions?

  • 🇳🇱Netherlands johnv

    Release workflow 2.1.7 has been created.
    Is the problem still there?

  • 🇫🇷France dcoppel

    Thanks a lot !
    I will try tomorrow and I will keep you inform of the result.
    Regards

  • 🇫🇷France dcoppel

    Hi,
    I was not able to make the test as after installing the new version 2.1.7 when accessing a node view :
    Drupal\Component\Plugin\Exception\PluginNotFoundException : Unable to determine class for field type 'workflow' found in the 'field.storage.node.field_cae_statut' configuration dans Drupal\field\FieldStorageConfigStorage->mapFromStorageRecords() (line 167 of web/core/modules/field/src/FieldStorageConfigStorage.php).

    I made a rollback on version 2.0.0.
    Thanks for your help.
    Regards

  • 🇳🇱Netherlands johnv

    Sorry to heat that. What Drupal version do you use?

  • 🇳🇱Netherlands johnv

    And to just ask the obvous:
    Do you have custom code?
    Did you run update.php?

  • 🇫🇷France dcoppel

    I use Drupal 10.5.2. No custom code on workflow fields and I did a drush updatedb ans drush cr + clear cache with Devel module.

    • johnv committed a5d86447 on 2.1.x
      Issue #3531782: better Annotation for WorkflowItem
      
  • 🇳🇱Netherlands johnv

    I have no idea. Apparently you have a problem with WorkflowItem.
    I have made a small change to the Attributes/Annotation of that. Please check that the next time you test.
    You might remove the Attributes of that, to see the result. (That is the part #[FieldType(id: "workflow", ...)])

    You also have not enabled the core Workflows (with - s) module?

    • johnv committed 9ec3aaf0 on 2.1.x
      Issue #3531782: better Annotation for WorkflowItem
      
    • johnv committed 0a399a94 on 2.1.x
      Issue #3531782: better Annotation for WorkflowItem
      
  • 🇫🇷France dcoppel

    I'll tried to reinstall workflow module 2.1.7 and I was no problem at this time.
    Nervertheless, the original issue regarding "Property target_id is unknown" still exist.
    I did a rollback to version 2.0.0.
    Thanks to try resolving this issue !

  • 🇳🇱Netherlands johnv
  • 🇳🇱Netherlands johnv

    I think the WorkflowItem::propertyDefinitions must be updated in workflow. Install file.
    There, the entity types are updated for WorkflowTransition and WorkflowScheculed Transition, but not the field type WorkflowItem.

    Not sure how to do that, yet.

  • 🇳🇱Netherlands johnv

    Can you enable Configuration inspector module and run admin/reports/config-inspector ? Does that give anything

    See also:

    https://drupal.stackexchange.com/questions/198628/how-do-i-fix-a-mismatc...

  • 🇫🇷France dcoppel

    I think I found what is trigged the initial issue !

    I use a rule basing on workflow transition. Here is the description of the rule :

    The event is : After saving a new Workflow transition entity
    The condition is : A data compare on workflow_transition.to_sid.target_id information
    Action is : Send an email.

    Can you try it to reproduce my issue ?
    Thanks a lot !
    Regards

  • 🇳🇱Netherlands johnv

    That is good news! Finally :-)

    It seems this Rule stems from a previous D7 site.
    As per D8, you can use Workflow Field value just a any other field value.
    I suggest you change the Rule accordingly, already in your current site, before upgrading Workflow module.

    Chances are that the 'target_id' (which is now 'value') returns, when WorkflowItem should inherit from EntityReferencyItem instead of StringItem, asit is now.

Production build 0.71.5 2024