For me it was related to Kernel.php
I was adding new schedule task into the Kernel. I also updated some controllers, views, and installed twilio extension.
The error did not provide more information than
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255
@Suresh Pangeni refences the Kernel.php doc so I checked by doc that is in PROJECTFOLDER\app\Console\Kernel.php
protected $commands = [
Commands\Inspire::class,
Commands\Test::class
\App\Console\Commands\Message::class,
];
Missing Comma between Commands\Test::class and the next line didn't let me proceed. It provided no further warning or information when I ran composer dump-autoload.
Hope this can help someone else that has a similar issue!