Loading...
Loading...
Debugs and fixes dbt errors systematically. Use when working with dbt errors for: (1) Task mentions "fix", "error", "broken", "failing", "debug", "wrong", or "not working" (2) Compilation Error, Database Error, or test failures occur (3) Model produces incorrect output or unexpected results (4) Need to troubleshoot why a dbt command failed Reads full error, checks upstream first, runs dbt build (not just compile) to verify fix.
npx skill4agent add altimateai/data-engineering-skills debugging-dbt-errorsdbt builddbt builddbt compile --select <model_name>
# or
dbt build --select <model_name># Preview current output
dbt show --select <model_name> --limit 20
# Check specific values with inline query
dbt show --inline "select * from {{ ref('model_name') }} where <condition>" --limit 10
# Compare with expected - look for patterns
dbt show --inline "select column, count(*) from {{ ref('model_name') }} group by 1 order by 2 desc" --limit 10cat target/compiled/<project>/<path>/<model_name>.sql| Error Type | Look For |
|---|---|
| Compilation Error | Jinja syntax, missing refs, YAML issues |
| Database Error | Column not found, type mismatch, SQL syntax |
| Dependency Error | Missing model, circular reference |
# Find what this model references
grep -E "ref\(|source\(" models/<path>/<model_name>.sql
# Read upstream model to verify columns
cat models/<path>/<upstream_model>.sql| Error | Fix |
|---|---|
| Column not found | Check upstream model's output columns |
| Ambiguous column | Add table alias: |
| Type mismatch | Add explicit |
| Division by zero | Use |
| Jinja error | Check matching |
dbt build --select <model_name># Preview the data
dbt show --select <model_name> --limit 10
# Run tests
dbt test --select <model_name># Find downstream models
grep -r "ref('<model_name>')" models/ --include="*.sql"
# Rebuild downstream
dbt build --select <model_name>+{{ }}{% %}target/compiled/