ホーム>Laravel>【Laravel】How to Fix 'Handler::report(Exception $exception) must be compatible with report(Throwable $e) in Handler.php on line 37'
Laravel

【Laravel】How to Fix 'Handler::report(Exception $exception) must be compatible with report(Throwable $e) in Handler.php on line 37'

Thank you for your continued support.
This article contains advertisements that help fund our operations.

Why Laravel's 'Declaration of Handler::report() must be compatible with...' error happens, how to fix it, and why Handler.php is gone in Laravel 11+.

Full Error Message

PHP Fatal error: Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in /var/www/html/app/Exceptions/Handler.php on line 37

Cause

This is PHP's "a child class method's argument type doesn't match the parent class method's" error (must be compatible with).

app/Exceptions/Handler.php extends Laravel's Illuminate\Foundation\Exceptions\Handler. In Laravel 7, the parent class's report() argument type changed from Exception to Throwable.

So if a project upgraded from Laravel 6 or earlier still has its Handler.php written the old way (Exception $exception), the type no longer matches the parent class and this error is thrown.

Throwable was introduced in PHP 7 as a common parent interface for both Exception and Error, and Laravel moved to it so it could handle Error the same way as Exception, not just the latter.

Solution

Changing Exception to Throwable resolves it.

use Throwable; // Explicitly use Throwable

// Old style (Laravel 6 and earlier)
public function report(Exception $exception)
{
    parent::report($exception);
}

// Fixed (Laravel 7 and later)
public function report(Throwable $exception)
{
    parent::report($exception);
}

The Same Error Can Happen in render() or renderForConsole() Too

The same "must be compatible with" error can show up for any overridden method, not just report(). Check the method name in the error message and match its argument and return types to the current signature in the parent class (Illuminate\Foundation\Exceptions\Handler).

// render() also needs to accept Throwable
public function render($request, Throwable $exception)
{
    return parent::render($request, $exception);
}

The parent class's method signatures (argument types, and sometimes return type declarations) can differ by Laravel version, so if the error persists, check the actual signature inside the vendor directory:

cat vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php

If You're on Laravel 11+: Handler.php No Longer Exists by Default

Laravel 11 overhauled exception handling. New projects no longer have an app/Exceptions/Handler.php file at all — exception handling is now configured via withExceptions() in bootstrap/app.php.

// bootstrap/app.php (Laravel 11+)
->withExceptions(function (Exceptions $exceptions) {
    $exceptions->report(function (Throwable $e) {
        // custom report logic
    });
})

This error almost always shows up when a project originally built on Laravel 6 or earlier has been upgraded, and its Handler.php still has the old-style code. On Laravel 10 and earlier, the fix in this article (ExceptionThrowable) resolves it. If you started a brand-new project on Laravel 11+, there's no Handler.php to begin with, so check bootstrap/app.php instead.

What to Include When Asking an AI Chat Tool

If you're asking an AI chat tool (ChatGPT, Claude chat, etc. — not an agent that can run commands itself), you'll need to describe your situation yourself. Pasting the following gets you a much more accurate answer:

  • The full error message (including the file name and line number, don't trim it)
  • Output of php artisan --version (your Laravel version)
  • The relevant method from app/Exceptions/Handler.php, if it exists
  • The withExceptions() block from bootstrap/app.php, if you're on Laravel 11+
  • Which version you upgraded from, if you know (for an inherited legacy project)

Your Laravel version and the relevant Handler.php code are almost always essential for narrowing down the cause.

Summary

This error happens because a method's argument type in Handler.php no longer matches the parent class's type in the Laravel framework. Changing Exception to Throwable fixes it in most cases — but projects created on Laravel 11+ don't have a Handler.php at all, so check bootstrap/app.php's withExceptions() instead.

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!