Error with workflow in preview: InvalidArgumentException: the state '' does not exist in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase->getState()

Created on 29 January 2024, 11 months ago
Updated 19 August 2024, 4 months ago

Problem/Motivation

Create a node in Draft, and change the status in preview mode without error.

Steps to reproduce

Create a node in Draft, and change the status in preview mode.

InvalidArgumentException: The state '' does not exist in workflow. in Drupal\workflows\Plugin\WorkflowTypeBase->getState() (line 155 of core/modules/workflows/src/Plugin/WorkflowTypeBase.php).
Drupal\content_moderation\Plugin\WorkflowType\ContentModeration->getState() (Line: 162)
Drupal\content_moderation\Form\EntityModerationForm->submitForm()
call_user_func_array() (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 224)
Drupal\Core\Form\FormBuilder->getForm() (Line: 296)
Drupal\content_moderation\EntityOperations->entityView() (Line: 192)
content_moderation_entity_view() (Line: 52)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler::Drupal\hook_event_dispatcher\{closure}() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 67)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith() (Line: 59)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAll() (Line: 288)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 238)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func_array() (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 797)
Drupal\Core\Render\Renderer->doCallback() (Line: 386)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 239)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Patch

🐛 Bug report
Status

Postponed: needs info

Version

11.0 🔥

Component
Content moderation 

Last updated 17 days ago

Created by

🇫🇷France Uroki

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.

  • Issue created by @Uroki
  • This is neither usability nor novice, so I removed those tags.

  • Exceptions that can be shown by merely using the UI are usually major prioity.

  • 🇫🇷France Uroki

    Ok, thank you for the correction.

  • 🇮🇳India samit.310@gmail.com

    Hi @Uroki,

    I am trying it to reproduce it with Drupal 11.x, it is wotking as expected, looks like it it is not relate to 11.x branch. Can you please share all the reproducible steps here.

    Thanks
    Samit K.

  • Status changed to Postponed: needs info 5 months ago
  • 🇫🇷France Uroki

    Hi @samit.310@gmail.com,

    I work on Drupal 10.3.0 now and i didn't tested it in 11.x.

    To reproduce you must have a workflow set, with the workflows core module who contain a "draft" status.
    After that, save a new node in draft status, preview-it and change the status from draft to "published" on preview mode.

    Simplier steps:

    1. Save a new node in draft
    2. You are redirected on the preview mode
    3. On the preview mode use the workflow selector to pass it on published
    4. Click on apply button
    5. wsod
Production build 0.71.5 2024