Fly.io "release command failed" in CI
Fly runs the configured release_command (commonly database migrations) in a temporary machine before switching traffic. When that command exits non-zero, flyctl fails the deploy so a broken release does not go live.
What this error means
A flyctl deploy step fails with "Error: release command failed - aborting deployment" and shows the release command exit status.
Error: release command failed - aborting deployment, error: ... exit code 1Common causes
The release command itself failed
A migration or setup task in release_command returned non-zero, so the deploy is aborted before the cutover.
The release machine lacks needed config
The release command needs a secret or database connection that is not available to the temporary release machine.
How to fix it
Read the release command output
- Read the release command logs in the flyctl output.
- Reproduce the command (for example the migration) against the same database.
- Fix it, then redeploy.
Provide config to the release command
Ensure the secrets and database URL the release command needs are set so it can run in the release machine.
# fly.toml
[deploy]
release_command = "npm run migrate"How to prevent it
- Test the release command (migrations) before deploying.
- Set the secrets and database URL the release command needs.
- Keep migrations idempotent so reruns are safe.