Julien
11/19/2025, 10:35 AMMarvin
11/19/2025, 10:35 AMMarvin
11/19/2025, 10:42 AMprefect.flow-run.Completed event.
- Does the trigger actually match the upstream event?
- Event name/pattern: includes prefect.flow-run.Completed
- Resource matching: avoid matching by flow-run name; prefer Related resource → role “deployment” (or “flow”) that produced the upstream run. Tag filters must match exactly.
- Threshold/posture: Reactive, threshold=1, no “within” required.
- Did the automation fire? Look for prefect.automation.triggered in Events. If you see it, the trigger fired and the issue is in the action. If you don’t, the trigger didn’t match or wasn’t evaluated.
- Is the action configured correctly?
- Run deployment: choose “Selected deployment” and pick your downstream deployment. Avoid “Inferred”.
- Parameters/templates: try a trivial action (e.g., “Do nothing” or a notification) to confirm the trigger fires; then re-add run-deployment.
How to pinpoint the break
- In the Events UI: filter for your upstream run and look for:
1) prefect.flow-run.Completed (from the upstream run)
2) prefect.automation.triggered (for your second automation)
3) prefect.automation.action.triggered and then ...action.executed (for the action’s result)
- If 1 exists but 2 does not: the trigger didn’t match (filters/event name/threshold).
- If 2 exists but no action events: the action isn’t configured or failed silently; re-check the action target and parameters.
API examples (optional, to trace the chain)
Replace placeholders with your values; run with a Prefect API key in env.
# 1) Confirm the upstream flow-run completed event was recorded
curl -s -X POST <https://api.prefect.cloud/api/events/filter> \
-H "Authorization: Bearer $PREFECT_API_KEY" \
-d '{
"filter": {
"events": {"filter": "prefect.flow-run.Completed"},
"resource": {"filter": "prefect.flow-run."}
},
"limit": 50
}' | jq '.events | length'
# 2) Check if your automation fired
# Find events for your automation by automation id (prefect.automation.<automation_id>)
curl -s -X POST <https://api.prefect.cloud/api/events/filter> \
-H "Authorization: Bearer $PREFECT_API_KEY" \
-d "{
\"filter\": {
\"events\": {\"filter\": \"prefect.automation.triggered\"},
\"resource\": {\"filter\": \"prefect.automation.<YOUR_AUTOMATION_ID>\"}
},
\"limit\": 20
}" | jq '.events[] | {id, occurred, event, resource: .resource."prefect.resource.id"}'
# 3) If it fired, check the action events
curl -s -X POST <https://api.prefect.cloud/api/events/filter> \
-H "Authorization: Bearer $PREFECT_API_KEY" \
-d "{
\"filter\": {
\"events\": {\"filter\": \"prefect.automation.action.*\"},
\"resource\": {\"filter\": \"prefect.automation.<YOUR_AUTOMATION_ID>\"}
},
\"limit\": 50
}" | jq '.events[] | {event, occurred, payload}'
Common gotchas
- Matching the wrong resource: prefect.flow-run.Completed events are for flow-runs. If you match by resource name (often the flow-run name) or by deployment name in the main filter, it won’t match. Use “Related resource” → role “deployment” or “flow” with the correct item, or a reliable tag.
- Tag mismatches: if your trigger uses tags, ensure the upstream run actually has them.
- Proactive posture/threshold: if set, the trigger may wait for absence of events or multiple events before firing.
- “Inferred” run-deployment action: can be ambiguous and sometimes blocked; use “Selected deployment”.
Helpful docs
- Automations overview: Automations concept
- Event triggers (matching, posture, thresholds): Event triggersMarvin
11/19/2025, 10:42 AMJulien
11/19/2025, 10:51 AMMarvin
11/19/2025, 10:51 AMMarvin
11/19/2025, 10:53 AMexpect includes Crashed/TimedOut/Failed. It will not fire on Completed. If your intent is to chain on completion, you’ll need to add prefect.flow-run.Completed (see example below).
- It requires a specific tag: match_related requires the event to have a related resource with role tag and id prefect.tag.notify-on-failure. If your upstream flow run (or its deployment/flow) does not actually carry that tag, the trigger will never match.
How to confirm where it’s stuck
1) Check if your upstream run produced a matching event
- In the Events UI, filter for the upstream flow run and look for:
- For failures: prefect.flow-run.Failed (or Crashed/TimedOut)
- For completions: prefect.flow-run.Completed
2) Check if the automation fired
- Search for prefect.automation.triggered scoped to your automation. If you don’t see this, the trigger didn’t match (filters/tags/event name/threshold).
3) Verify the tag filter actually matches
- Open a known upstream flow-run event and inspect its “Related” resources.
- Do you see a related resource with role tag and id exactly prefect.tag.notify-on-failure?
- If not, that’s the blocker. Either add that tag to the upstream deployment/flow so it appears on the run, or remove/change the tag filter.
Quick A/B test to isolate the issue
- Temporarily remove the match_related block (tag requirement), keep everything else the same, and reproduce the upstream event.
- If it fires now, the tag filter was the mismatch.
- Alternatively, add prefect.flow-run.Completed to expect and test a completed run if that’s your intent.
Examples
A) Trigger on Completed (keeping your tag requirement)
{
"type": "event",
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"match_related": {
"prefect.resource.id": [
"prefect.tag.notify-on-failure"
],
"prefect.resource.role": "tag"
},
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Reactive",
"threshold": 1,
"within": 0
}
B) Trigger on Failed/Crashed/TimedOut but without tag filtering (to test)
{
"type": "event",
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"expect": [
"prefect.flow-run.Crashed",
"prefect.flow-run.TimedOut",
"prefect.flow-run.Failed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Reactive",
"threshold": 1,
"within": 0
}
If you need to scope to a specific upstream deployment instead of a tag, use match_related for role `deployment`:
"match_related": {
"prefect.resource.id": ["prefect.deployment.<YOUR_DEPLOYMENT_ID>"],
"prefect.resource.role": "deployment"
}
Helpful docs
- Automations overview: Automations concept
- Event matching (expect/match/match_related): Event triggers
- Events and related resources: Events concept
- Chaining deployments: Chaining deployments how-to
If you can confirm:
- Whether you want to trigger on Completed or only on failures
- A sample upstream flow run ID and whether it actually has the notify-on-failure tag
- The action you’re using (e.g., Run deployment, selected vs inferred)
…I can spot the exact change to make this automation fire.Julien
11/19/2025, 11:05 AMMarvin
11/19/2025, 11:05 AMMarvin
11/19/2025, 11:06 AMprefect.automation.triggered. If you see zero entries, the trigger didn’t match any events.
2) Sanity-test with a known-good trigger
Create (or temporarily change to) this very permissive trigger to prove evaluation is working. It will fire on any flow-run event:
{
"type": "event",
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"expect": [
"prefect.flow-run.*"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Reactive",
"threshold": 1,
"within": 0
}
- Then run any flow in the same workspace. You should see an prefect.automation.triggered event and the action run (use a simple action like “Do nothing” to verify the trigger fires).
3) If it still doesn’t fire, trace the events
Use the Events UI or the API to confirm the upstream event exists and whether the automation triggered:
# A) Do flow-run events exist?
curl -s -X POST <https://api.prefect.cloud/api/events/filter> \
-H "Authorization: Bearer $PREFECT_API_KEY" \
-d '{"filter": {"events": {"filter": "prefect.flow-run.*"}}, "limit": 20}' | jq '.events | length'
# B) Did your automation fire?
curl -s -X POST <https://api.prefect.cloud/api/events/filter> \
-H "Authorization: Bearer $PREFECT_API_KEY" \
-d "{
\"filter\": {
\"events\": {\"filter\": \"prefect.automation.triggered\"},
\"resource\": {\"filter\": \"prefect.automation.<YOUR_AUTOMATION_ID>\"}
},
\"limit\": 20
}" | jq '.events[] | {occurred, event, resource: .resource."prefect.resource.id"}'
- If A returns 0, no flow-run events are being recorded (different workspace?).
- If A > 0 but B returns 0, the trigger isn’t matching; please share the current trigger JSON.
- If B shows triggers but you don’t see downstream effects, the action may be misconfigured or failing; check for prefect.automation.action.failed events.
4) Common pitfalls that match your symptoms
- Different workspace: your upstream flow runs must be in the same workspace as the automation.
- Automation disabled: easy to miss if you cloned/edited an existing one.
- Expect/match not actually broadened: if expect is empty it matches all events; if match is empty it matches all resources; if either still set narrowly, it can block.
- Using “Run deployment” with Inferred target: this can be blocked (infinite loop safeguards) or fail; try “Do nothing” or “Selected deployment” just to confirm the trigger itself fires.
Helpful docs
- Automations overview: Automations concept
- Event triggers (expect/match/match_related): Event triggers
- Events concept: Events concept
- Chaining deployments: Chaining deployments how-to
If you can share:
- The current trigger JSON (after removing filters)
- The automation ID
- A specific upstream flow run ID and when it finished
- The current action configuration
…I’ll pinpoint why it isn’t matching and suggest the exact fix.Julien
11/19/2025, 11:08 AMMarvin
11/19/2025, 11:09 AMMarvin
11/19/2025, 11:12 AMcurl -s -X POST <http://localhost:4200/api/events/filter> \
-H "Content-Type: application/json" \
-d '{"filter": {"event": {"prefix": ["prefect.flow-run."]}}, "limit": 20}'
- Check if your automation fired
curl -s -X POST <http://localhost:4200/api/events/filter> \
-H "Content-Type: application/json" \
-d "{
\"filter\": {
\"event\": {\"name\": [\"prefect.automation.triggered\", \"prefect.automation.resolved\"]},
\"resource\": {\"id\": [\"prefect.automation.<YOUR_AUTOMATION_ID>\"] }
},
\"limit\": 50
}"
- Very permissive trigger to sanity-check evaluation
Set your automation trigger to:
{
"type": "event",
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"expect": [
"prefect.flow-run.*"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Reactive",
"threshold": 1,
"within": 0
}
Then run any flow in the same workspace; re-check the prefect.automation.triggered events via the API.
Other things to confirm
- Automation is enabled on the detail page.
- You’re testing in the same workspace as the automation.
- Temporarily set the action to “Do nothing” to isolate trigger evaluation from action execution.
- If using run-deployment, use “Selected deployment” rather than “Inferred”.
Docs for reference
- Automations: Automations concept
- Event triggers: Event triggers
- Events API (query): Read events API
If you can share your current trigger JSON (after removing filters), your automation ID, and one flow run ID you expect to match, I can help you craft the exact filter to verify whether it should match and why it isn’t.