Fatal error on content save I recently set up a local version of a remote site. The remote site is allowing me to create content fine, but for some reason the local version is throwing the following error upon save:

Drupal\Core\Entity\EntityStorageException: 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 ')) ORDER BY users_field_data_2.name ASC' at line 4: SELECT base_table.uid AS uid, base_table.uid AS base_table_uid, users_field_data_2.name AS name FROM {users} base_table INNER JOIN {users_field_data} users_field_data ON users_field_data.uid = base_table.uid INNER JOIN {user__roles} user__roles ON user__roles.entity_id = base_table.uid LEFT JOIN {users_field_data} users_field_data_2 ON users_field_data_2.uid = base_table.uid WHERE (users_field_data.status = :db_condition_placeholder_0) AND (user__roles.roles_target_id IN ()) ORDER BY users_field_data_2.name ASC; Array ( [:db_condition_placeholder_0] =&gt; 1 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;save() (line 770 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

This error also crops up on some admin pages, which seems to be related: Warning: Invalid argument supplied for foreach() in Drupal\Core\Database\Query\Condition-&gt;compile() (line 227 of core/lib/Drupal/Core/Database/Query/Condition.php).

I've done a handful of updates to the site since creating the local version but haven't tried creating new content until now, so it's hard to tell what started causing the error. Any suggestions on how to move forward with diagnosing this?
I realized that it must have been a database issue since the live and local sites were in sync except for some module installs -- same with the code. I pulled the live database and imported it into local and re-installed the modules one at a time. Everything is now working fine. All that I can figure is that there was an installation error somewhere along the way that didn't want to show itself.