Last updated: November 30, 2026. Added a short direct answer, current Expertrec product facts, definitions of key terms, clearer headings and a clearer list.
If you receive the error message “No such entity.”, “No such entity with” or “No such entity with customerId” in Magento 2, the issue usually occurred when you try to load not existing object via Magento 2 Repository Class.
The ‘No such entity with customerId’ error in Magento 2 appears when code tries to load an object that does not exist through a Repository class. The usual fix is to debug the backtrace in NoSuchEntityException.php, find the source (often a third-party extension), and wrap the call in a try-catch block. Revert the debug code afterward.

- Error variants: ‘No such entity.’, ‘No such entity with’, and ‘No such entity with customerId’.
- Reported case: exceptions after upgrading to Magento 2.3.2.
Key terms
- NoSuchEntityException: the Magento\Framework\Exception class thrown when code tries to load an object that does not exist.
- Repository class: the Magento 2 class through which the object is loaded; loading a missing object through it triggers the error.
- Third-party extensions: they often trigger this error, so the fix may need overriding their code with a try-catch.
Causes of the ‘No Such Entity with CustomerId’ Error in Magento 2
Sorry to say this, but as usual, after upgrading Magento versions something is wrong at the end. I did have no exceptions and no errors before. Now upgrading to 2.3.2 I get exceptions like: [2019-06-25 21:46:34] main.CRITICAL: Keine Eintrag mit customerId = 1 {“exception”:”[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): Keine Eintrag mit customerId = 1 at /var/www/vhosts/hopfenmuseum-tettnang.de/magento.hopfenexpress.de/vendor/magento/framework/Exception/NoSuchEntityException.php:50)”} []
To debug this issue, please open the file
vendor/magento/framework/Exception/NoSuchEntityException.php
and at the beginning of the __construct method temporary add debug backtrace code:
foreach (debug_backtrace() as $_stack) {
echo ($_stack["file"] ? $_stack["file"] : '') . ':' .
($_stack["line"] ? $_stack["line"] : '') . ' - ' .
($_stack["function"] ? $_stack["function"] : '');
}
exit();
Debug code example for NoSuchEntityException
public function __construct(Phrase $phrase = null, Exception $cause = null, $code = 0)
{
foreach (debug_backtrace() as $_stack) {
echo ($_stack["file"] ? $_stack["file"] : '') . ':' .
($_stack["line"] ? $_stack["line"] : '') . ' - ' .
($_stack["function"] ? $_stack["function"] : '');
}
exit();
if ($phrase === null) {
$phrase = new Phrase('No such entity.');
}
parent::__construct($phrase, $cause, $code);
}
save the file and refresh the page.
Debug steps and fix
- Open vendor/magento/framework/Exception/NoSuchEntityException.php.
- Temporarily add the debug backtrace code at the beginning of the __construct method.
- Save the file and refresh the page.
- Use the debug backtrace to identify the source of the issue.
- Override the third-party extension code and add a “try-catch” exception.
- Revert the changes in the NoSuchEntityException.php file.
Conclusion:
You will see the debug backtrace that will allow you to define the issue source and you will get an idea of how to fix it.
Usually, third-party Magento 2 extensions lead up to this problem, so you can override their code and add a “try-catch” exception.
Don’t forget to revert changes in NoSuchEntityException.php file after you’re finished.
Just like in Magento the custom search in drupal is pretty tricky to set up and can cause a lot of issues. However, there are good drupal custom search solutions that can be used to set up drupal search easily and fast with even sophisticated features like drupal faceted search.




