Moderated content Issue

Created on 20 April 2023, about 1 year ago
Updated 3 August 2023, 10 months ago

Hi All,

Could anybody have issue with Moderated content, How to fix it? Please see below the issue when I clicking on that after created the
Workflow Type States Operations
Editorial Content moderation Draft,Review,Published,Unpublished,Archive Edit
The URL from localhost:
/admin/config/workflow/workflows
/admin/content/moderated

I really applicate very much. If anyone could help about this.

Thank you,

---------------------------------------------------------------------------------------------
The website encountered an unexpected error. Please try again later.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.content_moderation_state' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "content_moderation_state" "base_table" LEFT JOIN "content_moderation_state_field_data" "content_moderation_state_field_data" ON "content_moderation_state_field_data"."id" = "base_table"."id" INNER JOIN "content_moderation_state_field_data" "content_moderation_state_field_data_2" ON "content_moderation_state_field_data_2"."id" = "base_table"."id" WHERE ("content_moderation_state_field_data_2"."content_entity_type_id" LIKE :db_condition_placeholder_0 ESCAPE '\\') AND ("content_moderation_state_field_data_2"."moderation_state" NOT LIKE :db_condition_placeholder_1 ESCAPE '\\') GROUP BY "content_moderation_state_field_data"."content_entity_revision_id") "subquery"; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => published ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 267 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
Drupal\Core\Database\StatementWrapper->execute() (Line: 946)
Drupal\Core\Database\Connection->query() (Line: 525)
Drupal\Core\Database\Query\Select->execute() (Line: 267)
Drupal\Core\Entity\Query\Sql\Query->result() (Line: 171)
Drupal\Core\Entity\Query\Sql\QueryAggregate->result() (Line: 33)
Drupal\Core\Entity\Query\Sql\QueryAggregate->execute() (Line: 316)
Drupal\Core\Entity\Query\QueryBase->initializePager() (Line: 246)
Drupal\Core\Entity\Query\Sql\Query->finish() (Line: 138)
Drupal\Core\Entity\Query\Sql\QueryAggregate->finish() (Line: 32)
Drupal\Core\Entity\Query\Sql\QueryAggregate->execute() (Line: 94)
Drupal\content_moderation\ModeratedNodeListBuilder->getEntityRevisionIds() (Line: 71)
Drupal\content_moderation\ModeratedNodeListBuilder->load() (Line: 218)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 123)
Drupal\content_moderation\ModeratedNodeListBuilder->render() (Line: 23)
Drupal\content_moderation\Controller\ModeratedContentController->nodeListing()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
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: 44)
Drupal\services\StackMiddleware\FormatSetter->handle() (Line: 270)
Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
Drupal\shield\ShieldMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)

--------------------------------------*******************-------------------------------------
When Checking on some node /node/2714/edit.
here the issue
The website encountered an unexpected error. Please try again later.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.content_moderation_state_revision' doesn't exist: SELECT "base_table"."revision_id" AS "revision_id", "base_table"."id" AS "id" FROM "content_moderation_state_revision" "base_table" INNER JOIN "content_moderation_state_field_revision" "content_moderation_state_field_revision" ON "content_moderation_state_field_revision"."revision_id" = "base_table"."revision_id" WHERE ("content_moderation_state_field_revision"."content_entity_type_id" LIKE :db_condition_placeholder_0 ESCAPE '\\') AND ("content_moderation_state_field_revision"."content_entity_id" = :db_condition_placeholder_1) AND ("content_moderation_state_field_revision"."content_entity_revision_id" = :db_condition_placeholder_2) AND ("content_moderation_state_field_revision"."workflow" = :db_condition_placeholder_3) AND ("content_moderation_state_field_revision"."langcode" = :db_condition_placeholder_4) ORDER BY "base_table"."revision_id" DESC; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 2714 [:db_condition_placeholder_2] => 41211 [:db_condition_placeholder_3] => editorial [:db_condition_placeholder_4] => und ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 272 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
Drupal\Core\Database\StatementWrapper->execute() (Line: 946)
Drupal\Core\Database\Connection->query() (Line: 525)
Drupal\Core\Database\Query\Select->execute() (Line: 272)
Drupal\Core\Entity\Query\Sql\Query->result() (Line: 84)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 88)
Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList->loadContentModerationStateRevision() (Line: 53)
Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList->getModerationStateId() (Line: 26)
Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList->computeValue() (Line: 34)
Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList->ensureComputedValue() (Line: 141)
Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList->count()
count() (Line: 74)
Drupal\Core\Field\WidgetBase->form() (Line: 112)
Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget->form() (Line: 183)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm() (Line: 121)
Drupal\Core\Entity\ContentEntityForm->form() (Line: 127)
Drupal\node\NodeForm->form() (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
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: 44)
Drupal\services\StackMiddleware\FormatSetter->handle() (Line: 270)
Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
Drupal\shield\ShieldMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)

--------------------------------------------------------------

💬 Support request
Status

Postponed: needs info

Version

9.5

Component
Workflows  →

Last updated about 2 months ago

  • Maintained by
  • 🇦🇺Australia @Sam152
Created by

🇺🇸United States smethawee

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

Comments & Activities

  • Issue created by @smethawee
  • 🇮🇳India Nishant

    Tried to reproduce your issue on local as per your requirement, Content moderation is working fine as I have tested with change moderation state with Draft,Review,Published,Unpublished,Archive,Edit
    Also able to edit any node without any error.
    with the below configuration, but unable to see the error.

    Seems like "Content Moderation" and "Workflows" module not installed properly on your system.

    Drupal version: 9.5.x-dev
    PHP version: 8.0.28

  • 🇺🇸United States smethawee

    @Nishant,

    Thank you for you to took a look on it. Here Even I tried to delete the Content Moderation" and "Workflow module please check what I got below: FYI: This Drupal 9.5.8 php 8.1.12

    The website encountered an unexpected error. Please try again later.

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.content_moderation_state' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "content_moderation_state" "base_table" INNER JOIN "content_moderation_state_field_data" "content_moderation_state_field_data" ON "content_moderation_state_field_data"."id" = "base_table"."id" WHERE "content_moderation_state_field_data"."workflow" = :db_condition_placeholder_0 GROUP BY "base_table"."revision_id", "base_table"."id" LIMIT 1 OFFSET 0) "subquery"; Array ( [:db_condition_placeholder_0] => editorial ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 267 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
    Drupal\Core\Database\StatementWrapper->execute() (Line: 946)
    Drupal\Core\Database\Connection->query() (Line: 525)
    Drupal\Core\Database\Query\Select->execute() (Line: 267)
    Drupal\Core\Entity\Query\Sql\Query->result() (Line: 84)
    Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 121)
    Drupal\content_moderation\Plugin\WorkflowType\ContentModeration->workflowHasData() (Line: 20)
    Drupal\workflows\Form\WorkflowDeleteForm->buildForm()
    call_user_func_array() (Line: 534)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 281)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    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: 44)
    Drupal\services\StackMiddleware\FormatSetter->handle() (Line: 270)
    Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
    Drupal\shield\ShieldMiddleware->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    --------------------------------------
    And olso here the status deatial of /admin/reports/status page

    Entity/field definitions
    Mismatched entity and/or field definitions
    The following changes were detected in the entity type and field definitions.
    Content moderation state
    The Content moderation state entity type needs to be installed.
    Workflow
    The Workflow entity type needs to be installed.
    Paragraph
    The Moderation state field needs to be uninstalled.

  • 🇮🇳India Nishant

    @smethawee,

    I am unable to reproduce this issue, Can you please try to install properly on another environment.

  • 🇺🇸United States smethawee

    @Nishant,

    Yes, I did on my Stage now. Here what I got....when I clicked on /admin/modules/uninstall

    --------------------------------
    The website encountered an unexpected error. Please try again later.

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.content_moderation_state' doesn't exist: SELECT "base_table"."revision_id" AS "revision_id", "base_table"."id" AS "id" FROM "content_moderation_state" "base_table" GROUP BY "base_table"."revision_id", "base_table"."id" LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 272 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
    Drupal\Core\Database\StatementWrapper->execute() (Line: 946)
    Drupal\Core\Database\Connection->query() (Line: 525)
    Drupal\Core\Database\Query\Select->execute() (Line: 272)
    Drupal\Core\Entity\Query\Sql\Query->result() (Line: 84)
    Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 651)
    Drupal\Core\Entity\EntityStorageBase->hasData() (Line: 43)
    Drupal\Core\Entity\ContentUninstallValidator->validate() (Line: 624)
    Drupal\Core\Extension\ModuleInstaller->validateUninstall() (Line: 99)
    Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall() (Line: 165)
    Drupal\system\Form\ModulesUninstallForm->buildForm()
    call_user_func_array() (Line: 534)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 281)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    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: 44)
    Drupal\services\StackMiddleware\FormatSetter->handle() (Line: 270)
    Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
    Drupal\shield\ShieldMiddleware->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    -------------------------------------------------------------------
    And When I click on /node/add/article > Applied to Article node please see below:

    The website encountered an unexpected error. Please try again later.

    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: 366)
    Drupal\content_moderation\EntityTypeInfo->formAlter() (Line: 167)
    content_moderation_form_alter() (Line: 562)
    Drupal\Core\Extension\ModuleHandler->alter() (Line: 838)
    Drupal\Core\Form\FormBuilder->prepareForm() (Line: 282)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    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: 44)
    Drupal\services\StackMiddleware\FormatSetter->handle() (Line: 270)
    Drupal\shield\ShieldMiddleware->bypass() (Line: 137)
    Drupal\shield\ShieldMiddleware->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    I really don't know what going on with this config or?

  • Hello,

    I checked but issue is not reproduce.

    I followed the steps as asked by you.

    Thanks

  • Status changed to Postponed: needs info about 1 year ago
  • 🇳🇱Netherlands daffie

    According to @neelam_wadhwani is the problem not reproduceable.

  • Hi @smethawee,
    did you solve this error? I'm facing the same issue when I clicked on /admin/modules/uninstall

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dg8_10.content_moderation_state' doesn't exist: SELECT "base_table"."revision_id" AS "revision_id", "base_table"."id" AS "id" FROM "content_moderation_state" "base_table" GROUP BY "base_table"."revision_id", "base_table"."id" LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 271 of core\lib\Drupal\Core\Entity\Query\Sql\Query.php).

  • Hi @smethawee, did you solve this error? I'm getting the same error when I clicked on /admin/modules/uninstall

Production build 0.69.0 2024