Lejb Golovatyi
12/28/2025, 12:27 PMMarvin
12/28/2025, 12:27 PMMarvin
12/28/2025, 12:31 PMprefect deployment run --watch streams events/logs and exits as soon as it sees a terminal state (Completed/Failed/Cancelled/Crashed), then waits ~3s for any “straggler” logs before closing. If your terminal stays stuck after the flow succeeds, the watcher likely didn’t receive the terminal event (e.g., a transient event stream issue, proxy buffering, or self-hosted background services not fully running).
A few quick things to try:
- Add a timeout so the watch cannot hang indefinitely
prefect deployment run 'FLOW/DEPLOYMENT' --watch --watch-timeout 300
This will exit after 5 minutes even if a terminal event isn’t received.
- Confirm you’re on a recent 3.x
prefect --version
If you’re on an older release, upgrade:
pip install -U prefect
There have been steady improvements to the event/log subscriber.
- If you’re self-hosting Prefect Server, make sure Background Services are running and healthy (they’re responsible for event delivery). If you’re on Prefect Cloud, check Prefect Status if this happens intermittently.
- As a workaround if you need a non-blocking run:
- Run without --watch, then inspect or fetch logs by ID:
# Create the run (no watch)
prefect deployment run 'FLOW/DEPLOYMENT'
# Inspect or fetch logs once you have the run ID
prefect flow-run inspect RUN_ID
prefect flow-run logs RUN_ID --tail
If you can share a bit more detail, I can help narrow it down:
- Output of prefect --version
- Prefect Cloud or self-hosted Server?
- The exact command you ran
- Does it happen every time or intermittently?
- If self-hosted, logs from the API/Background Services when the watch hangs
- Whether you’re behind a proxy or using a terminal that may buffer long-lived HTTP streams
If it’s repeatable and you’re on a recent 3.x, we can dig deeper (and I can open an issue with the details).Lejb Golovatyi
12/28/2025, 12:38 PMMarvin
12/28/2025, 12:38 PMMarvin
12/28/2025, 12:42 PMprefect deployment run 'FLOW/DEPLOYMENT' --watch --watch-timeout 300
- Or run without --watch and then inspect/logs by run ID:
prefect deployment run 'FLOW/DEPLOYMENT'
# Copy the run ID from the output or UI
prefect flow-run inspect RUN_ID
prefect flow-run logs RUN_ID --tail
To help us diagnose and file a bug, could you share:
- One or two example flow run IDs where this occurred
- Approximate timestamp/timezone
- Your OS and shell (e.g., macOS zsh, Windows PowerShell)
- Whether you’re behind a proxy/VPN
- What you see at the end of the watch output (e.g., does it show “Completed” and then hang, or does it just stop streaming?)
If you can re-run once with debug logs and paste the last ~50 lines, that’s super helpful:
export PREFECT_LOGGING_LEVEL=DEBUG
prefect deployment run 'FLOW/DEPLOYMENT' --watch --watch-timeout 300
What I’ve verified so far:
- The CLI does support --watch and --watch-timeout (event-stream based).
- I don’t see an existing public issue for 3.6.8 hangs with --watch.
- This behavior is consistent with the watcher not receiving the terminal state event from the stream (Cloud) and waiting forever unless a timeout is set.
If you’d like, I can open a GitHub issue on your behalf once you share a reproducible run ID and environment details. Otherwise, feel free to file one directly here: Open a Prefect issue. I’ll keep an eye on it and route it to the right folks.
Also, if this suddenly starts/started happening today, you can check Prefect Status just in case — but since it’s every time for you on 3.6.8, I’m leaning toward a client-side regression.