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.

Updated

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 7

Composer’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:

composer.json
{
    "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.

# 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 found

Fixes

# at the end of every deploy, once the new files are in place
composer dump-autoload --optimize --classmap-authoritative --no-dev

What 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.

Early access

The private beta is open, by invitation, to a handful of teams running a JavaScript, TypeScript, PHP or Python app in production. Join the waitlist and we’ll write to invite you.