Skip to content

Maintenance role exits 0 after a failed migration outside development #5709

Closed

Description

@FXschwartz

Also from reviewing serverpod/serverpod_docs#833, which now documents this as expected behaviour ("check the logs for failures"). I don't think it is.

dart bin/main.dart --role maintenance --apply-migrations is the documented way to apply migrations from CI, and the whole point is the exit code. Today a failed migration only fails the process in development:

run mode log exit code
development ERROR: Failed to apply database migrations. 1
test / staging / production ERROR: Failed to apply database migrations. 0

This looks like a regression rather than a design choice. Before #3740 the catch in Serverpod._applyMigrations set _exitCode = 1, so maintenance failed in every mode. #3740 swapped that for an unconditional throw ExitException(1), then #3852 made the throw development-only so a running server wouldn't shut down on an integrity failure. That fix was about the monolith role, but it also took the exit code away from the maintenance role, and the maintenance role has nothing else to report. It also contradicts the Cloud docs, which say a failed migration fails the deploy.

Related: #3959 wants the maintenance role to stop calling exit altogether, so whatever we do here should fit with that.

Activity

  1. added
    bug
    on Sep 15, 2026
  2. added
    ux
    area: cli
    on Sep 16, 2026
  3. moved this from Inbox 📫 to Next Up 🎯 in Serverpod Frameworkson Sep 16, 2026
  4. moved this from Next Up 🎯 to In Progress 🔥 in Serverpod Frameworkson Sep 17, 2026
  5. moved this from In Progress 🔥 to Done 🚀 in Serverpod Frameworkson Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: clibugux

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions