Repository navigation
fix: register the register:app artisan command reliably - #1607
Merged
Merged
Conversation
AppServiceProvider::boot() calls Artisan (storage:link, migrate, key:generate). An Artisan call made while providers are still booting loads the console commands before the framework's booted callback adds app/Console/Commands to the discovery paths, so register:app was never registered for that process. In the Docker image this happened on every run: the storage:link guard looked for public/storage/.gitignore, which the image does not ship, so storage:link ran on every boot (and every web request). - Register RegisterApp explicitly in AppServiceProvider::register(), which runs before any boot-time Artisan call. - Guard storage:link on the public/storage link itself. Fixes #1606
This was referenced Oct 3, 2026
Closed
…sses Adding app/Console/Commands and routes/console.php to the console kernel in register() fixes discovery for every command, including closure commands in routes/console.php, rather than only for RegisterApp. The test now checks every command in app/Console/Commands is registered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1606.
What
php artisan register:appfails in the linuxserver image withThere are no commands defined in the "register" namespace.Why
The cause is not the
withRouting(commands: ...)call suggested in the issue:Application::configure()already callswithCommands()with no arguments, which addsapp/Console/Commands. The real problem is ordering:app->booted()callback.AppServiceProvider::boot()can callArtisan::call()(storage:link,migrate,key:generate). That nested call bootstraps the kernel and marks its commands as loaded while providers are still booting, before the path exists. Discovery never runs again, soregister:appis missing for the rest of that process.storage:linkguard checks forpublic/storage/.gitignore, and the image does not shipstorage/app/public/.gitignore. Sostorage:linkruns on every boot, including every web request.From source checkouts the
.gitignoreis present, which is why it does not reproduce outside the container (except on the first run after a version bump, whenmigrateruns at boot).Changes
AppServiceProvider::register()addsapp/Console/Commandsandroutes/console.phpto the console kernel directly. This runs before any boot-time Artisan call, so discovery works for every command (including future closure commands inroutes/console.php), not justregister:app.storage:linkonpublic/storageitself rather than a dotfile inside it. This also stops a pointlessstorage:linkon every request in the container.tests/Feature/ConsoleCommandsTest.php: asserts every command class inapp/Console/Commandsis registered. The test DB is always fresh, so every test boot goes through the boot-timemigratecall; the test fails before this change and passes after.Verified
lscr.io/linuxserver/heimdall:latest(2.8.3) with the patched provider:register:appand a test closure command inroutes/console.phpboth run, with an existing DB and with a fresh DB (migrate at boot).