InvalidArgumentException: The state '' does not exist in workflow

Created on 19 August 2022, almost 3 years ago
Updated 3 August 2023, about 2 years ago

In a content-moderated node, there is a multi-valued file field. Whatever state the node is in, whenever editing it, I can upload a file for the first time, but always fail afterwards. And there is a log message:
InvalidArgumentException: The state '' does not exist in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase->getState() (line 155 of /var/www/myproject/web/core/modules/workflows/src/Plugin/WorkflowTypeBase.php).

Edit: not only multi-valued file field, but also the single-valued image field.

πŸ› Bug report
Status

Closed: outdated

Version

9.5

Component
WorkflowsΒ  β†’

Last updated about 23 hours ago

  • Maintained by
  • πŸ‡¦πŸ‡ΊAustralia @Sam152
Created by

πŸ‡¨πŸ‡³China fishfree

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since this has been in PNMI for 11 months going to close out for now.

    If still a valid bug though please reopen updating the issue summary with steps to trigger this error.

    Tried enabling the workflow module but I don't see any issue for what it's worth.

    Thanks all!

  • πŸ‡΅πŸ‡°Pakistan isalmanhaider

    Getting the same error

    InvalidArgumentException: The state '' does not exist in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase->getState() (line 155 of core/modules/workflows/src/Plugin/WorkflowTypeBase.php).

    Steps to reproduce:

    under "this workflow applies to" select article, basic page or any content type at /admin/config/workflow/workflows/manage/editorial
    then visit node/add/article or node/add/pager you will get WSOD with the following error

    Drupal 10.1.4
    PHP 8.2.6
    content_moderation: 10.1.4
    workbench_moderation: 8.x-1.7

  • πŸ‡¨πŸ‡³China fishfree

    It seemd the error occured when an AJAX operation occured.

  • πŸ‡ΊπŸ‡ΈUnited States mmenavas

    I got the same error message when I was trying to preview a new node that had content moderation enabled. The source of the issue was a bug πŸ› Had an issue with preview button Needs work in the workflow_buttons β†’ module.

  • πŸ‡ΊπŸ‡ΈUnited States mmenavas
  • Status changed to Needs work 1 day ago
  • Reopening this. Ran into this issue on 11.2.2 core. Added repro steps

  • First commit to issue fork.
  • πŸ‡―πŸ‡΅Japan neptune-dc

    I can confirm that the updated repro steps result in an error. Thanks a lot.

    This is what I got from my test_state:

    ```
    The website encountered an unexpected error. Try again later.

    InvalidArgumentException: The state 'test_state' does not exist in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase->getState() (line 141 of core/modules/workflows/src/Plugin/WorkflowTypeBase.php).
    Drupal\content_moderation\Plugin\WorkflowType\ContentModeration->getState() (Line: 353)
    Drupal\diff\DiffEntityComparison->getModerationState() (Line: 286)
    Drupal\diff\DiffEntityComparison->getRevisionDescription() (Line: 381)
    Drupal\diff\Form\RevisionOverviewForm->buildRevision() (Line: 304)
    Drupal\diff\Form\RevisionOverviewForm->buildForm()
    call_user_func_array() (Line: 528)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 219)
    Drupal\Core\Form\FormBuilder->getForm() (Line: 29)
    Drupal\diff\Controller\NodeRevisionController->revisionOverview()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 633)
    Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
    Fiber->start() (Line: 634)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    ```

  • πŸ‡―πŸ‡΅Japan neptune-dc

    Isn't this a problem for the Diff module though? It seems like the situation is that the diff module isn't handling deleted states correctly.

Production build 0.71.5 2024