Site broken after removing comment fields (Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper)

Created on 9 June 2016, about 8 years ago
Updated 21 August 2023, 10 months ago

Hi, I was editing a D8 site, when it suddenly stopped working and started to display white screen with this error message:

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

Apache's log shows this:

Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper: "Exception in Recent comments[comments_recent]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '1') ))\nORDER BY comment_field_data_created DESC, comment_field_data_cid DESC\n' at line 1: SELECT comment_field_data.created AS comment_field_data_created, comment_field_data.cid AS comment_field_data_cid, comment_field_data.cid AS cid\nFROM \n{comment_field_data} comment_field_data\nWHERE (( (comment_field_data.status = :db_condition_placeholder_0) AND (.status = :db_condition_placeholder_1) ))\nORDER BY comment_field_data_created DESC, comment_field_data_cid DESC\nLIMIT 10 OFFSET 0; Array\n(\n [:db_condition_placeholder_0] => 1\n [:db_condition_placeholder_1] => 1\n)\n" at /.../public_html/core/modules/views/src/Plugin/views/query/Sql.php line 1452, referer: ...

The issue is probably related to comments module. Here is what I have done before the site stopped working:

1. I have imported content from D7 site using core Migrate modules. It all worked well.

2. Comments were disabled for every content type from the start.

3. Since I don't use comments, I have deleted comment fields from all of the content types.

4. I wanted to uninstall Comments module, but that option was disabled, with the message that there are fields pending deletion.

5. Therefore, I started cron, which finished quickly and didn't display any errors.

6. After a minute or two, the whole backend stopped working. It's interesting, though, that frontend still does work. However, if I transfer the site to my localhost, neither the frontend nor the backend display anything but the first error (The website encountered an unexpected error. Please try again later.).

Since I'm using a stable version and this breaks a site, I have marked this issue as major.

How to fix this problem? Thank you for any suggestions.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

9.5

Component
CommentΒ  β†’

Last updated 2 days ago

Created by

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.

Production build 0.69.0 2024