Skip to content
Data
Skill

/troubleshooting-dbt-job-errors

Diagnoses dbt Cloud/platform job failures by analyzing run logs, querying the Admin API, reviewing git history, and investigating data issues. Use when a dbt Cloud/platform job fails and you need to diagnose the root cause, especially when error messages are unclear or when

From plugin
dbt-agent-skills
65315 skills
Install
$ npx -y skills add dbt-labs/dbt-agent-skills --skill troubleshooting-dbt-job-errors --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/troubleshooting-dbt-job-errors

Context preview

The summary Claude sees to decide when to auto-load this skill.

Diagnoses dbt Cloud/platform job failures by analyzing run logs, querying the Admin API, reviewing git history, and investigating data issues. Use when a dbt Cloud/platform job fails and you need to diagnose the root cause, especially when error messages are unclear or when

SKILL.md

troubleshooting-dbt-job-errors.SKILL.md
name: troubleshooting-dbt-job-errors
description: Diagnoses dbt Cloud/platform job failures by analyzing run logs, querying the Admin API, reviewing git history, and investigating data issues. Use when a dbt Cloud/platform job fails and you need to diagnose the root cause, especially when error messages are unclear or when intermittent failures occur. Do not use for local dbt development errors.
user-invocable: false
metadata:
  author: dbt-labs

Troubleshooting dbt Job Errors

Systematically diagnose and resolve dbt Cloud job failures using available MCP tools, CLI commands, and data investigation.

When to Use

  • dbt Cloud / dbt platform job failed and you need to find the root cause
  • Intermittent job failures that are hard to reproduce
  • Error messages that don't clearly indicate the problem
  • Post-merge failures where a recent change may have caused the issue

**Not for:** Local dbt development errors - use the skill `using-dbt-for-analytics-engineering` instead

The Iron Rule

**Never modify a test to make it pass without understanding why it's failing.**

A failing test is evidence of a problem. Changing the test to pass hides the problem. Investigate the root cause first.

Rationalizations That Mean STOP

| You're Thinking... | Reality | |-------------------|---------| | "Just make the test pass" | The test is telling you something is wrong. Investigate first. | | "There's a board meeting in 2 hours" | Rushing to a fix without diagnosis creates bigger problems. | | "We've already spent 2 days on this" | Sunk cost doesn't justify skipping proper diagnosis. | | "I'll just update the accepted values" | Are the new values valid business data or bugs? Verify first. | | "It's probably just a flaky test" | "Flaky" means there's an overall issue. Find it. We don't allow flaky tests to stay. |

Workflow

flowchart TD
    A[Job failure reported] --> B{MCP Admin API available?}
    B -->|yes| C[Use list_jobs_runs to get history]
    B -->|no| D[Ask user for logs and run_results.json]
    C --> E[Use get_job_run_error for details]
    D --> F[Classify error type]
    E --> F
    F --> G{Error type?}
    G -->|Infrastructure| H[Check warehouse, connections, timeouts]
    G -->|Code/Compilation| I[Check git history for recent changes]
    G -->|Data/Test Failure| J[Use discovering-data skill to investigate]
    H --> K{Root cause found?}
    I --> K
    J --> K
    K -->|yes| L[Create branch, implement fix]
    K -->|no| M[Create findings document]
    L --> N[Add test - prefer unit test]
    N --> O[Create PR with explanation]
    M --> P[Document what was checked and next steps]

Step 1: Gather Job Run Information

If dbt MCP Server Admin API Available

Use these tools first - they provide the most comprehensive data:

| Tool | Purpose | |------|---------| | `list_jobs_runs` | Get recent run history, identify patterns | | `get_job_run_error` | Get detailed error message and context |

# Example: Get recent runs for job 12345
list_jobs_runs(job_id=12345, limit=10)

# Example: Get error details for specific run
get_job_run_error(run_id=67890)

Without MCP Admin API

**Ask the user to provide these artifacts:**

1. **Job run logs** from dbt Cloud UI (Debug logs preferred) 2. **`run_results.json`** - contains execution status for each node

To get the `run_results.json`, generate the artifact URL for the user:

https://<DBT_ENDPOINT>/api/v2/accounts/<ACCOUNT_ID>/runs/<RUN_ID>/artifacts/run_results.json?step=<STEP_NUMBER>

Where:

  • `<DBT_ENDPOINT>` - The dbt Cloud endpoint. e.g
  • `cloud.getdbt.com` for the US multi-tenant platform (there are other endpoints for other regions)
  • `ACCOUNT_PREFIX.us1.dbt.com` for the cell-based platforms (there are different cell endpoints for different regions and cloud providers)
  • `<ACCOUNT_ID>` - The dbt Cloud account ID
  • `<RUN_ID>` - The failed job run ID
  • `<STEP_NUMBER>` - The step that failed (e.g., if step 4 failed, use `?step=4`)

Example request: > "I don't have access to the dbt MCP server. Could you provide: > 1. The debug logs from dbt Cloud (Job Run → Logs → Download) > 2. The run_results.json - open this URL and copy/paste or upload the contents: > `https://cloud.getdbt.com/api/v2/accounts/12345/runs/67890/artifacts/run_results.json?step=4`

Step 2: Classify the Error

| Error Type | Indicators | Primary Investigation | |------------|-----------|----------------------| | **Infrastructure** | Connection timeout, warehouse error, permissions | Check warehouse status, connection settings | | **Code/Compilation** | Undefined macro, syntax error, parsing error | Check git history for recent changes, use LSP tools | | **Data/Test Failure** | Test failed with N results, schema mismatch | Use `discovering-data` skill to query actual data |

Step 3: Investigate Root Cause

For Infrastructure Errors

1. Check job configuration (timeout settings, execution steps, etc.) 2. Look for concurrent jobs competing for resources 3. Check if failures correlate with time of day or data volume

For Code/Compilation Errors

1. **Check git history for recent changes:**

If you're not in the dbt project directory, use the dbt MCP server to find the repository:

   # Get project details including repository URL and project subdirectory
   get_project_details(project_id=<project_id>)

The response includes:

  • `repository` - The git repository URL
  • `dbt_project_subdirectory` - Optional subfolder where the dbt project lives (e.g., `dbt/`, `transform/analytics/`)

Then either:

  • Query the repository directly using `gh` CLI if it's on GitHub
  • Clone to a temporary folder: `git clone <repo_url> /tmp/dbt-investigation`

**Important:** If the project is in a subfolder, navigate to it after cloning:

   cd /tmp/dbt-investigation/<project_subdirectory>

Once in the project directory:

   git log --oneline -20
   git diff HEAD~5..HEAD --
Read more
Ships withdbt-agent-skills

A curated collection of Agent Skills for working with dbt. These skills help AI agents understand and execute dbt workflows more effectively.

Get the whole plugin

Other skills on dbt-agent-skills.