<@ULVA73B9P> is there a quick way to get a list of...
# ask-marvin
j
@Marvin is there a quick way to get a list of truncated failure messages from a set of failed flow runs without having to click into each in the cloud UI
m
thought for 156.4 seconds
Yes — not really in the Cloud UI list view, but yes via CLI or Python. Quick answer: - UI: no bulk list of failure messages in the runs table - CLI:
prefect flow-run ls
can list failed runs, but the table output does not include messages - Best workaround: use
prefect flow-run inspect
per run, or use the Python client to fetch many runs and print
state.message
CLI options verified: -
prefect flow-run ls --help
-
prefect flow-run inspect --help
A quick shell pattern is:
Copy code
bash
prefect flow-run ls --state FAILED
Then inspect individual runs:
Copy code
bash
prefect flow-run inspect <FLOW_RUN_ID> --output json
If you want a bulk list without clicking, Python is the fastest option:
Copy code
python
import asyncio
from prefect import get_client
from prefect.client.schemas.filters import FlowRunFilter

async def main():
    async with get_client() as client:
        runs = await client.read_flow_runs(
            flow_run_filter=FlowRunFilter(
                state={"type": {"any_": ["FAILED", "CRASHED"]}}
            ),
            limit=50,
        )

        for run in runs:
            msg = run.state.message if run.state else None
            short = (msg[:120] + "...") if msg and len(msg) > 120 else msg
            print(f"{run.id} | {run.name} | {short}")

asyncio.run(main())
That gives you a compact, truncated summary of failed run messages across many runs. If helpful, I can also give you: - a one-liner using the REST API / CLI JSON output - a version filtered by deployment name or time window - a script that exports these to CSV Related docs: - Prefect docs - Python client reference
j
@Marvin Thanks for the snippet. Didn't this exist in the UI previously though?
m
thought for 27.8 seconds
I’m not able to verify historical UI behavior from source/docs right now. My best recollection is: - there have been UI views/version changes where more state detail was visible in lists or hover/details panels - but in current Prefect 3.x Cloud, the main flow run list does not provide a convenient bulk view of failure messages comparable to clicking into each run So: you’re not imagining it — it’s plausible an older UI exposed this more directly, but I can’t confirm exactly which version or screen without better evidence. If you want, I can help with one of two things: 1. a tiny script that reproduces that old “scan failures quickly” workflow, or 2. a search for recent community threads to see whether others noticed the same UI change.