Fix Unexpected error: query condition 'users_field_data.mail IN ()' cannot be empty

Created on 22 December 2022, about 2 years ago
Updated 3 May 2023, over 1 year ago

Problem/Motivation

If there is a user without an email address then sending an email can be caused the following error:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\InvalidQueryException</em>: Query condition &#039;users_field_data.mail IN ()&#039; cannot be empty. in <em class="placeholder">Drupal\Core\Database\Query\Condition-&gt;condition()</em> (line <em class="placeholder">104</em> of <em class="placeholder">core/lib/Drupal/Core/Database/Query/Condition.php</em>). <pre class="backtrace">Drupal\Core\Database\Query\Select-&gt;condition(&#039;users_field_data.mail&#039;, Array, &#039;IN&#039;) (Line: 61)
Drupal\Core\Entity\Query\Sql\Condition-&gt;compile(Object) (Line: 163)
Drupal\Core\Entity\Query\Sql\Query-&gt;compile() (Line: 74)
Drupal\Core\Entity\Query\Sql\Query-&gt;execute() (Line: 504)
Drupal\Core\Entity\EntityStorageBase-&gt;loadByProperties(Array) (Line: 256)
user_load_by_mail()

Steps to reproduce

Given
When
Then

Proposed resolution

Remaining tasks

  • ✅ File an issue about this project
  • ❌ Addition/Change/Update/Fix to this project
  • ❌ Testing to ensure no regression
  • ❌ Automated unit/functional testing coverage
  • ❌ Developer Documentation support on feature change/addition
  • ❌ User Guide Documentation support on feature change/addition
  • ❌ Accessibility and Readability
  • ❌ Code review from 1 Varbase core team member
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ❌ Update Release Notes and Update Helper on new feature change/addition
  • ❌ Release

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
🐛 Bug report
Status

Closed: won't fix

Version

6.5

Component

Code

Created by

🇯🇴Jordan YazanMajadba

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.71.5 2024