Skip to content
Latchkey

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.

flyctl
Error: release command failed - aborting deployment, error: ... exit code 1

Common 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

  1. Read the release command logs in the flyctl output.
  2. Reproduce the command (for example the migration) against the same database.
  3. 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
# 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.

Frequently asked questions

What causes "Fly.io "release command failed""?
A migration or setup task in release_command returned non-zero, so the deploy is aborted before the cutover.
How do I fix Fly.io "release command failed"?
Read the release command output

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card