How do I fix the errors I get after removing the comment field from a content type? 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-&gt;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?
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.