Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

indi3's avatar
Level 3

ReflectionException: Class App\Policies\ModelPolicy does not exist in Command

Hello all! After moving a laravel 5.5 application to another server I am getting error logs with auth:

[2021-03-01 15:15:50] local.ERROR: Uncaught Error: Call to undefined method App\Http\Kernel::getMiddlewareGroups() in Command line code:1
Stack trace:
#0 {main}
  thrown {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 1): Uncaught Error: Call to undefined method App\Http\Kernel::getMiddlewareGroups() in Command line code:1
Stack trace:
#0 {main}
  thrown at Command line code:1)
[stacktrace]
#0 {main}
"} 

rrorException(code: 1): Uncaught ReflectionException: Class App\Policies\ModelPolicy does not exist in Command line code:1
Stack trace:
#0 Command line code(1): ReflectionClass->__construct('App\\Policies\\Mo...')
#1 [internal function]: {closure}('App\\Policies\\Mo...', 'App\\Model')
#2 Command line code(1): array_map(Object(Closure), Array, Array)
#3 {main}
  thrown at Command line code:1)
[stacktrace]
#0 {main}
"} 

The ModelPolicy line comes from the AuthServiceProvider I think. But I don't really know what happened since it was woking before the move.

Any help or tips would be highly appreciated.

Thanks

0 likes
4 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

Are you sure all files are there. Is the files and namespace have proper capitalization.

Just sounds like either a file is missing or a letter case problem.

4 likes
indi3's avatar
Level 3

Thanks!!! There were files missing. Always the little things...

jlrdw's avatar

@indi3 can you show post as answered, glad you got it working.

2 likes

Please or to participate in this conversation.