Slack alerts for dbt Cloud job failures, with root cause

By General Input

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.

Integrations

  • dbt Cloud
  • Slack Bot

Type

Agentic Task

Categories

  • Engineering
  • Operations

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.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seatsPause marketing emails to escalated customers, then restore them