0

After I removed the comment field from the user interface, and uninstalled the Comments module, I can't open any Article node.

In the Drupal log, I find this message.

InvalidArgumentException: Field comment is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 580 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Drupal\Core\Entity\ContentEntityBase->get("comment") (Line: 17)
gavias_sanbro_preprocess_node(Array, "node", Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render("node", Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, "kernel.view", Object)
call_user_func(Array, Object, "kernel.view", Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch("kernel.view", Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

How can I fix this issue?

  • This is the error from apache webserver : Uncaught PHP Exception InvalidArgumentException: "Field comment is unknown." at /var/www/eierc/core/lib/Drupal/Core/Entity/ContentEntityBase.php line 580 – ussrback Mar 23 at 9:17
  • Drupal log message after i enabled verbose: pastebin.com/s3wPwhYx – ussrback Mar 23 at 9:18
  • Please always add such information to your question instead of pasting it into the comments. This will help others to suggest steps to perform for solving your issue. – Mario Steinitz Mar 23 at 9:37
1

Given your error stacktrace:

Check function gavias_sanbro_preprocess_node() (Line: 287 in your gavias_sanbro.theme theme file).

This preprocessing function obviously tries to access the comment field without checking, whether it exists. As you uninstalled the field, it is causing your exception.

You may comment out, remove, or alter the code accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.