Skip to content

fix: error instead of panic on max_unavailable=0 in fly.toml (#4262)#4945

Draft
kylemclaren wants to merge 1 commit into
masterfrom
fix/issue-4262
Draft

fix: error instead of panic on max_unavailable=0 in fly.toml (#4262)#4945
kylemclaren wants to merge 1 commit into
masterfrom
fix/issue-4262

Conversation

@kylemclaren

@kylemclaren kylemclaren commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #4262.

fly deploy panicked with pool size must be > 0 when fly.toml set [deploy] max_unavailable = 0. The config value was passed through unvalidated (only the --max-unavailable flag was checked), so the rolling planner computed a pool size of 0 and hit panic("pool size must be > 0").

This validates max_unavailable coming from both the flag and fly.toml, returning a clear error instead of crashing.

Testing: added TestGetPoolSize — it fails on master (the panic path) and passes with the fix. go test ./internal/command/deploy/... is green.


Live-verified against a real org (ephemeral app, cleaned up afterward):

  • Latest flyctl (master): with [deploy] max_unavailable = 0, a second fly deploy panics — panic: pool size must be > 0 at internal/command/deploy/plan.go:411 (acquireLeases).
  • This branch: same live app, same config → no panic; clean Error: max_unavailable must be > 0 (got 0); set it to at least 1 or a fraction like 0.33.

🤖 Generated with Claude Code

A [deploy] max_unavailable = 0 value read from fly.toml bypassed the
--max-unavailable flag's "> 0" validation, producing a pool size of 0
that reached acquireLeases and hit a hard panic ("pool size must be
> 0").

Validate the config-file value where it is read in NewMachineDeployment,
mirroring the flag check, so the user gets a clear error. As
defense-in-depth, clamp getPoolSize to a minimum of 1 so a 0/negative
value can never panic acquireLeases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kylemclaren kylemclaren marked this pull request as draft June 30, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pool size must be > 0 error

1 participant