Slack alerts for dbt Cloud job failures, with root cause

When a dbt Cloud job fails, get a plain-English Slack alert that explains which models and tests broke, the likely cause, and a link to the run.

Agentic Task
dbt CloudSlack BotEngineeringOperationsNotifications & AlertsAI Reports
PromptCreate

Trigger this workflow with an incoming webhook, and point dbt Cloud's outbound job.run.errored notification at that webhook URL (in dbt Cloud, Account Settings then Notifications / Webhooks). The webhook fires whenever a dbt Cloud job run finishes in an errored state. From the webhook payload, read the account ID, the run ID, the job ID, and the job name so you can look up the rest.

When it fires, first confirm the run actually failed. Call the dbt Cloud Retrieve Run operation for that run ID and check the run status: 10 means Success, 20 means Error, and 30 means Cancelled. Only continue when the status is 20 (Error); if the run succeeded or was cancelled, stop without posting anything. Because a run can still be wrapping up when the webhook arrives, poll Retrieve Run until the run reports that it is complete before you try to read any results.

Once the run is complete and errored, gather the failure context. Call Retrieve Run Failure Details for the run to see which steps failed, then download the run_results.json artifact with Retrieve Run Artifact so you can see exactly which models and tests failed and their error messages. Important nuance: dbt sometimes sends the failure webhook before the run's artifacts are available through the API, so if the artifact is not ready yet, wait a short while and retry the fetch (for example a few attempts with a growing delay) until run_results.json comes back.

Read run_results.json and write a short, plain-English root-cause summary for a data team: what broke, which specific models or tests failed, and the most likely cause based on the error messages (for example a model compilation error, a failing data test with a row count, a missing source, or a database permission error). If several models or tests failed in the same run, group them all into one summary rather than sending a separate message for each failure.

Post the summary to Slack using the Slack Bot Send a Message operation, to the channel the user chooses (for example #data-alerts). Lead with the job name and the fact that it errored, include the concise root-cause summary and the list of failed models and tests, and add a direct link to the run in dbt Cloud so the team can open it in one click (build the run URL from the account's dbt Cloud host and the run ID). Send exactly one message per failed run.

Example output

🔴 dbt Cloud job failed: Daily Analytics Refresh Root cause: A data test failed on the orders model. not_null_orders_customer_id found 42 rows with a missing customer_id, which points to new orders arriving without a linked customer in the source system. Failed models and tests: • test: not_null_orders_customer_id (42 failing rows) • model: fct_order_items (skipped, depends on orders) Open the run in dbt Cloud: https://cloud.getdbt.com/deploy/12345/projects/678/runs/9012345/

Additional information

What does this prompt do?
  • Watches for dbt Cloud job runs that end in failure and reacts automatically, so no one has to babysit the run history.
  • Reads the failed run's results to pinpoint exactly which models and tests broke and what the errors say.
  • Writes a short, plain-English summary of what went wrong and the most likely cause.
  • Posts it to your chosen Slack channel with the job name and a one-click link to the run in dbt Cloud.
What do I need to use this?
  • A dbt Cloud account with the job you want to monitor.
  • Permission in dbt Cloud to add a failure notification that points at this workflow.
  • A Slack workspace and the channel where alerts should go.
How can I customize it?
  • Choose which Slack channel gets the alerts, for example a dedicated #data-alerts channel.
  • Decide how the summary reads, from a quick one-liner to a fuller breakdown of every failed model and test.
  • Adjust how long the workflow waits and retries before reading the results, in case they take a moment to become available.

Frequently asked questions

Will I get an alert for every dbt Cloud job, or just failures?
Only failures. The workflow ignores successful and cancelled runs and posts only when a job run ends in an error.
What if several models or tests fail in the same run?
They are grouped into a single Slack message for that run, so you get one clear alert instead of a flood of separate notifications.
Why does the summary sometimes take a moment to appear?
dbt Cloud occasionally reports a failure before the detailed results are ready. The workflow waits and retries until the run's results are available, then posts the summary.
Can I send the alerts to whichever channel my team watches?
Yes. You point it at the channel your data team follows, and you can set it up to post to more than one channel if you like.
Do I need to write any code to set this up?
No. You connect dbt Cloud and Slack, choose your channel, and the workflow handles the rest.

Stop hearing about broken dbt jobs from a downstream dashboard.

Get a clear, plain-English Slack alert the moment a dbt Cloud job fails, complete with the likely root cause and a direct link to the run.