Uncaught Error: Class 'Whoops\Util\Misc' not found

Today, I found this in the logs of a live site:

PHP Fatal error:  Uncaught Error: Class 'Whoops\Util\Misc' not found in /kirby/vendor/filp/whoops/src/Whoops/Run.php:302
#0 /kirby/vendor/filp/whoops/src/Whoops/Run.php(353): Whoops\Run->handleException(Object(Whoops\Exception\ErrorException))
#1 /kirby/vendor/composer/ClassLoader.php(444): Whoops\Run->handleError(2, 'include(/home/p...', '/home/xyz/p...', 444, Array)
#2 /kirby/vendor/composer/ClassLoader.php(444): include()
#3 /kirby/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/home/xyz/p...')
#5 /kirby/vendor/filp/whoops/src/Whoops/Run.php(375): spl_autoload_call('Whoops\\Util\\Mis...')
   in /kirby/vendor/filp/whoops/src/Whoops/Run.php on line 302

The config of the site has the debug mode turned off:

return [
    'debug' => false
];

What might cause this error and why is whoops called at all in live mode?

Not sure, maybe Whoops is called by the Panel as well when checking the system?

Have you tried to find the related request within the apache.log? Would be interesting to know which request caused this error.

Does this error only appear once or regularly? Just recently or a while ago? Maybe the class was called while the upload to the remove server was not complete yet.

We only have restricted access to the logs but I saw multiple occurences yesterday, two or three hours before we started pushing updates. But I’ll have to check if I’m mistaken by different timezones.

I’m still interested why Whoops was called at all. The panel might be an idea but still …

Maybe it relates to the License-Server?

Just ask for them :smiley: Shouldn’t be a big effort to provide.

But the license server is only called on first registration. As far as I’m aware there are no subsequent calls.

Yeah, will probably do that :slight_smile:

Would be great to know. I’m interested in this too. Might be by some bug. Can you help @bastianallgeier?

Do you get the same error in the logs?

No, as I did pause my Kirby 3 projects due to lack of spare time (just reading the forum, Github and some tutorials to build up knowledge and refresh my memory). I always wanna clear up those things before I face it in productive systems causing issues.

Would be interesting to get the logs to find the issue.

I will keep this in mind and if I can reproduce the same behavior . . . :wink:

Sorry to be late at the “party”. Whoops is also called in live mode. It’s not only there to show the debugger when debug mode is enabled, but handles and intercepts all kinds of errors. The debugger is just one nice feature of Whoops, but it’s also great at reacting to errors in general and handle them gracefully. Kirby’s “white screen of death” with the fatal error message is also displayed by whoops and all API requests with issues also use Whoops to show a json-formatted error response.

This still doesn’t explain why the Misc class in Whoops is not properly loaded. It could be an internal Whoops bug. I have to investigate. Could you open a ticket for it?

2 Likes

If you want to have some more insights how error handling is setup in Kirby, you can check out: https://github.com/getkirby/kirby/blob/master/src/Cms/AppErrors.php

1 Like

We found out today that the site in question was under heavy load from Chinese bots which caused timeouts on the server. So, right now, I’m sure this was a server issue and not a Kirby problem. Especially since I now know that it’s correct that Whoops is used in live mode.

So I don’t think it’s necessary to create an issue in this matter.
Is that okay with you, Bastian?

Hm, it’s still weird why the class could not be loaded to be honest. Let’s create the ticket anyway and maybe you can add a note about the DDOS attack to it.

Here we go: https://github.com/getkirby/kirby/issues/2429

1 Like