When we use entity browser widget to any field on node form and we click on Add New or Add Existing button and title is left empty, it gives following error:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\InvalidQueryException</em>: Query condition 'node_field_data.title IN ()' cannot be empty. in <em class="placeholder">Drupal\Core\Database\Query\Condition->condition()</em> (line <em class="placeholder">103</em> of <em class="placeholder">core/lib/Drupal/Core/Database/Query/Condition.php</em>). <pre class="backtrace">Drupal\Core\Database\Query\Select->condition('node_field_data.title', Array, 'IN') (Line: 61)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 163)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 74)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 504)
Drupal\Core\Entity\EntityStorageBase->loadByProperties(Array) (Line: 81)
Drupal\node_title_validation\Plugin\Validation\Constraint\NodeTitleConstraintValidator->validate(Object, Object) (Line: 185)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Object, '0000000027f7ef81000000005e48fe41', Array) (Line: 140)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 147)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 99)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 90)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 135)
Drupal\Core\TypedData\TypedData->validate() (Line: 482)
Drupal\Core\Entity\ContentEntityBase->validate() (Line: 189)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 83)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 276)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_agency_edit_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('node_agency_edit_form', Array, Object) (Line: 575)
Drupal\Core\Form\FormBuilder->processForm('node_agency_edit_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('node_agency_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 54)
Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments
Comment #2
vishalkhode commentedCreated patch to fix this issue.
Comment #3
vishalkhode commentedComment #5
vishalkhode commentedComment #6
krzysztof domańskiComment #7
yrocq commentedUpdated patch
Comment #8
yrocq commentedOops. Updated patch
Comment #9
cgomezgComment #10
umirtma commentedComment #11
yrocq commentedFix patch.
Comment #12
renrhafComment #13
renrhafNew patch with some improvements. The main issue which was an error displayed when no title is filled and some AJAX calls are done through the form (adding paragraphs, adding a field with multiple cardinality, entity browser, etc...) is fixed.
Comment #14
renrhafFix patch for latest dev version.
Comment #16
renrhafFix coding standards.
Comment #19
renrhafComment #20
renrhafComment #21
renrhaf