Error message
PHP: Class "…" not found
PHP can’t find a class it was asked for. When it starts right after a deploy, the code is almost never wrong: the files that ended up on the server and the class map that Composer built for them don’t agree. Unlike a memory or time limit, this one is an Error exception, so the Sentry SDK catches it like any other.
Examples run on 21 November 2026 with PHP 8.6.0, Composer 2.11.2, sentry/sentry 4.38.0, and Laravel 13.43.0 with sentry/sentry-laravel 4.31.0. Errilo is in private beta.
What the message says
PHP asks the registered autoloaders for the class. If none of them loads it, new App\Invoice() throws an Error (since PHP 7, you can catch it as a Throwable). Uncaught, with PHP 8.6.0:
Fatal error: Uncaught Error: Class "App\Invoice" not found in /tmp/shop/index.php:7
Stack trace:
#0 {main}
thrown in /tmp/shop/index.php on line 7Composer’s autoloader maps a namespace to a folder with a PSR-4 rule, and can also keep a map of every class it found when it was run:
{
"autoload": { "psr-4": { "App\\": "src/" } }
}Causes we reproduced
Each case below was run as a small app: App\ mapped to src/, sentry/sentry 4.38.0 installed.
- The class map is older than the files: the autoloader was built with
--classmap-authoritative(also what-adoes), which makes it trust its map and never look at the disk. A deploy that copies a newsrc/Invoice.phpwithout rebuilding the autoloader getsClass "App\Invoice" not found. With the autoloader optimized but not authoritative (--optimize), the same file added after the build was found through the PSR-4 rule: 42.00. - The case of the file name: class
Receiptinsrc/receipt.phpworks on macOS and Windows, whose file systems ignore case, and fails on Linux:Class "App\Receipt" not found. The file name must match the class name exactly. - A dev dependency used in production code: after
composer install --no-dev, a class of arequire-devpackage is not installed in the autoloader. Our code calling it gotClass "Acme\DevTool\Banner" not found, and the same code worked after a plaincomposer install. Move the package torequire, or stop using it in production.
# deploy v1
composer install --no-dev --classmap-authoritative
# deploy v2: the new file src/Invoice.php is copied, vendor/ stays as it was
php index.php # new App\Invoice() -> Class "App\Invoice" not foundFixes
- Build the autoloader after the files are in place, as the last step of the deploy. In our test it took the failing app back to
42.00. - Ship
vendor/and the code together, built once in CI, rather than a code update on top of an oldervendor/on the server. - Test on Linux before deploying, in CI, so a file name with the wrong case fails there and not in production.
# at the end of every deploy, once the new files are in place
composer dump-autoload --optimize --classmap-authoritative --no-devWhat the PHP SDK captures
An uncaught Error goes through the SDK’s exception handler. With plain sentry/sentry 4.38.0, in each of our three cases: exception type Error, value Class "App\Invoice" not found (the class name as PHP wrote it), unhandled, no level, and one frame, the line of index.php that used the class. A script with a deeper call stack would have more frames.
With Laravel 13.43.0 and sentry/sentry-laravel 4.31.0, a route that did new \App\Services\Invoicer() returned 500 and sent one event: type Error, same value, the request, 61 frames, the top one in routes/web.php.
Laravel has a second wording. When the class is resolved by the container (app(Invoicer::class) or an injected dependency), the message is not “not found”. Our route sent two chained exceptions: ReflectionException: Class "App\Services\Invoicer" does not exist, and the one that titles the issue, Illuminate\Contracts\Container\BindingResolutionException: Target class [App\Services\Invoicer] does not exist. Search for both when you look for a missing class in Laravel.
The setup is in the Laravel guide. We did not run this error on Symfony; the Symfony guide covers the setup.
How Errilo shows it
The issue is titled Error: Class "App\Invoice" not found, with an Unhandled badge and level Error (the event has no level). In Laravel, its location is the route closure that used the class.
Errilo groups on the type and the frames, not on the message. In our plain script, three different missing classes thrown from index.php, with no function around them, had the same fingerprint: one issue. In a framework the call stack differs between call sites, and the two Laravel wordings gave two issues. After a deploy, look at the first occurrence: if it is a few seconds after the release, it is the deploy.