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

vincent15000's avatar

Artisan::call fails without any error output

Hello,

I run the application with sail / docker.

Not tested in production with pure docker.

But with sail, both Artisan::call(...) commands don't work. The commands return 1 (instead of 0 for no error) and the Artisan::output() return an empty string.

session(['database_in_maintenance' => true]);

$migrateExitCode = Artisan::call('migrate:fresh');
$migrateOutput = Artisan::output();

$seedExitCode = Artisan::call('db:seed --class=ProductionSeeder');
$seedOutput = Artisan::output();

session(['database_in_maintenance' => false]);

if ($migrateExitCode !== 0 || $seedExitCode !== 0) {
    return response()->json(['migrate' => $migrateOutput, 'seed' => $seedOutput], 500);
}

return response()->json(null, 200);

Is it related to sail / docker ? Perhaps something specific to do ?

I have checked the logs, but no new logs are added when running these commands.

How can I get more informations about the error ?

Thanks for your help.

V

0 likes
1 reply
vincent15000's avatar
vincent15000
OP
Best Answer
Level 63

I have the answer, the problem is that it's a functionality for the user and the application is in production.

I have to add --force to the commands.

Please or to participate in this conversation.