Failed: timeout reached waiting for machine’s state to change
Error: timeout reached waiting for machine’s state to change
Your machine was created, but never started or exited immediately. This could mean that your app is taking a long time to start,
but it could be indicative of a region issue.
Alternatively, your app may have exited immediately due to a startup failure. Check your Dockerfile
to ensure it specifies a valid start command (e.g., check that your ‘CMD’ or ‘ENTRYPOINT’ is correct).
You can also try running ‘fly logs’ to see what happened when the machine tried to start.
You can try deploying to a different region,
or you can try increasing the timeout with the --wait-timeout flag
Hi… Start fly logs in a different terminal window (and leave it running there) and then try fly deploy again.
(The historical logs don’t always display correctly, but the live streaming usually works.)
Also, it can often help to post your full Dockerfile, fly.toml, and output of fly m list. You can use the </> button in the toolbar to get an area suitable for pasting code, output, etc.
fly.toml:
# fly.toml app configuration file generated for main-maintenance on 2025-12-05T10:19:37-05:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'azezment-www'
primary_region = 'ewr'
[build]
[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
[mounts]
source="storage"
destination="/storage"
Dockerfile:
FROM python:3.13.5 AS builder
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
RUN python -m venv .venv
COPY requirements.txt ./
RUN .venv/bin/pip install -r requirements.txt
FROM python:3.13.5-slim
WORKDIR /app
COPY --from=builder /app/.venv .venv/
COPY . .
CMD ["/app/.venv/bin/python", "app.py"]
LOGS (from cmd line fly deploy, after a fly machine destroy )
(.venv) alejandro@Alejandros-Mac-mini main-maintenance % pwd
/Volumes/700GB-APFS/WorkingDir/IdeaProjects/azezment-www/main-maintenance
(.venv) alejandro@Alejandros-Mac-mini main-maintenance % fly deploy
==> Verifying app config
Validating /Volumes/700GB-APFS/WorkingDir/IdeaProjects/azezment-www/main-maintenance/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
==> Building image with Depot
--> build: ()
[+] Building 1.0s (15/15) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 397B 0.1s
=> [internal] load metadata for docker.io/library/python:3.13.5-slim 0.3s
=> [internal] load metadata for docker.io/library/python:3.13.5 0.4s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 119B 0.1s
=> [builder 1/5] FROM docker.io/library/python:3.13.5@sha256:4ea77121eab13d9e71f2783d7505f5655b25bb7b2c263e8020aae3b555dbc0b2 0.0s
=> => resolve docker.io/library/python:3.13.5@sha256:4ea77121eab13d9e71f2783d7505f5655b25bb7b2c263e8020aae3b555dbc0b2 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 488B 0.0s
=> [stage-1 1/4] FROM docker.io/library/python:3.13.5-slim@sha256:4c2cf9917bd1cbacc5e9b07320025bdb7cdf2df7b0ceaccb55e9dd7e30987419 0.0s
=> => resolve docker.io/library/python:3.13.5-slim@sha256:4c2cf9917bd1cbacc5e9b07320025bdb7cdf2df7b0ceaccb55e9dd7e30987419 0.0s
=> CACHED [stage-1 2/4] WORKDIR /app 0.0s
=> CACHED [builder 2/5] WORKDIR /app 0.0s
=> CACHED [builder 3/5] RUN python -m venv .venv 0.0s
=> CACHED [builder 4/5] COPY requirements.txt ./ 0.0s
=> CACHED [builder 5/5] RUN .venv/bin/pip install -r requirements.txt 0.0s
=> CACHED [stage-1 3/4] COPY --from=builder /app/.venv .venv/ 0.0s
=> CACHED [stage-1 4/4] COPY . . 0.0s
=> exporting to image 0.3s
=> => exporting layers 0.0s
=> => exporting manifest sha256:bde6a06b4c1a71f0376bca3eb05c664a80e9ee7112b7bd74b3837f27398e76c6 0.0s
=> => exporting config sha256:8df9b1f13adf93634fdccbf718105c33c1919a90a7b1fcfe5507c10b34d35f06 0.0s
=> => pushing layers for registry.fly.io/azezment-www:deployment-01KBQR2EN5EJ40XEKY3RRBGW5Y@sha256:bde6a06b4c1a71f0376bca3eb05c664a80e9ee7112b7bd74b3837f27398e76c6 0.2s
=> => pushing layer sha256:8df9b1f13adf93634fdccbf718105c33c1919a90a7b1fcfe5507c10b34d35f06 0.1s
=> => pushing layer sha256:d4bd0213df6826da23a2de75632e64d26b078a8ad73d068988de1a5503b7d170 0.1s
=> => pushing layer sha256:78e882a8d5110221b8b5ab12d5ffa7aca96553e2d9ff937a3ed99bc47e1dafaf 0.1s
=> => pushing layer sha256:6d19b2b9297333ca5507d2ec45d6fbd88a9d12b8a1786703c7fddc2fb92bec24 0.1s
=> => pushing layer sha256:efcd233c129a8c717878c422a6b1d92e69a345cf45a86fb73511dc96ea4ab85f 0.1s
=> => pushing layer sha256:69ffb0af14e1dd2178ccf0e3ce16ace651aa18d33fb0f08a4edd9fb6d3ef85c3 0.0s
=> => pushing layer sha256:f6ebf66c5fcf81c3b035fee7a4e2d6002b7d78f1c6997dacd6db98580b59f78c 0.1s
=> => pushing layer sha256:ae56aedfe6df0acad342cdd853a8c3ec3ed6d07e8d4669769bd7f5f7ac06c066 0.1s
=> => pushing manifest for registry.fly.io/azezment-www:deployment-01KBQR2EN5EJ40XEKY3RRBGW5Y@sha256:bde6a06b4c1a71f0376bca3eb05c664a80e9ee7112b7bd74b3837f27398e76c6 0.1s
--> Build Summary: ()
--> Building image done
image: registry.fly.io/azezment-www:deployment-01KBQR2EN5EJ40XEKY3RRBGW5Y
image size: 52 MB
Watch your deployment at https://fly.io/apps/azezment-www/monitoring
Process groups have changed. This will:
* create 1 "app" machine
No machines in group app, launching a new machine
WARN failed to release lease for machine 185e356c0933d8 [app]: lease not found
-------
✖ Failed: timeout reached waiting for machine's state to change
-------
Error: timeout reached waiting for machine's state to change
Your machine was created, but never started or exited immediately. This could mean that your app is taking a long time to start,
but it could be indicative of a region issue.
Alternatively, your app may have exited immediately due to a startup failure. Check your Dockerfile
to ensure it specifies a valid start command (e.g., check that your 'CMD' or 'ENTRYPOINT' is correct).
You can also try running 'fly logs' to see what happened when the machine tried to start.
You can try deploying to a different region,
or you can try increasing the timeout with the --wait-timeout flag
LOGS (from fly console)
2025-12-05T17:13:50Z runner[185e356c0933d8] ewr [info]Pulling container image registry.fly.io/azezment-www@sha256:bde6a06b4c1a71f0376bca3eb05c664a80e9ee7112b7bd74b3837f27398e76c6
2025-12-05T17:13:50Z runner[185e356c0933d8] ewr [info]Container image registry.fly.io/azezment-www@sha256:bde6a06b4c1a71f0376bca3eb05c664a80e9ee7112b7bd74b3837f27398e76c6 already prepared
No machines in group app, launching a new machine
WARN failed to release lease for machine 185e356c0933d8 [app]: lease not found
Failed: timeout reached waiting for machine’s state to change
Error: timeout reached waiting for machine’s state to change
Your machine was created, but never started or exited immediately. This could mean that your app is taking a long time to start,
but it could be indicative of a region issue.
Alternatively, your app may have exited immediately due to a startup failure. Check your Dockerfile
to ensure it specifies a valid start command (e.g., check that your ‘CMD’ or ‘ENTRYPOINT’ is correct).
You can also try running ‘fly logs’ to see what happened when the machine tried to start.
You can try deploying to a different region,
or you can try increasing the timeout with the --wait-timeout flag
Thanks for all the details… There really should be way more lines in those logs, though, .
Your volume will cause any replacement Machine that you create in ewr to land on the same underlying physical host as the previous one did. If your app doesn’t strictly require being in that specific city, maybe try changing to iad?
You will need to fork (i.e., copy) the existing volume beforehand…
Thanks !! So, it looks like the app is hosed ? I was able to deploy my project under another app name ( azezment-www3 ) with no issues. I have a custom domain on namecheap with a shared IPV4 from fly and a cert deployed. Any tips how how to move ? any shortcuts or do do I need new certs, DNS config changes, etc? thanks for your help.
I don’t think the old app is necessarily a lost cause, possibly just that one physical host machine.
I would try forking the volume to iad, changing primary_region = 'iad' in fly.toml, and then redeploying (the original azezment-www).
Hm… I don’t know the certificates side that well, actually, since I don’t use those myself. It seems like Cloudflare and the Let’s Encrypt rate limits are the main things that generally trip people up with those.
(Someone else might jump in with more concrete and specific advice, though.)
I am minded in this case that your app is exiting prematurely, and that you just need to find out why. Machines should output what they are doing on boot to stdout, and this seems to be missing from what has been provided so far. Does Grafana add any more log detail? If you go to App > Machine > Logs, you can access a button called “Search logs in Grafana”.
(Your question is a bit hard to follow, as you’ve mashed together your logs, your Dockerfile, and your YAML config. If you can, use separate Markdown blocks for separate files, so that your questions are clear).