debugging-dbt-errors

For systematically debugging and fixing dbt errors. Use when tasks mention “fix/error/broken/fail/debug/not working”, when encountering compilation errors, database errors, or test failures, when a model produces incorrect or unexpected outputs, or when diagnosing dbt command failures. Read full error messages, check upstream dependencies first, and run dbt build to validate fixes.

Last repository push
GitHub Stars
137
Forks
13
Issues / PRs
5

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "debugging-dbt-errors" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9c9daac8ba2a7dff4cfd8a46016b0d513099169ca8611aa98c99bf1307d8a7d1. Verify the upstream source and version against https://github.com/AltimateAI/data-engineering-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

For systematically debugging and fixing dbt errors. Use when tasks mention “fix/error/broken/fail/debug/not working”, when encountering compilation errors, database errors, or test failures, when a model produces incorrect or unexpected outputs, or when diagnosing dbt command failures. Read full error messages, check upstream dependencies first, and run dbt build to validate fixes.

0 Downloads

Introduction source: third_party · AltimateAI · 0.0.1 Reference

SkillPi interpretation

Tasks
Read the full error. Check upstream first. ALWAYS run `dbt build` after fixing.**
Inputs and outputs
dbt show --select <model_name> --limit 20
Software, accounts and paid services
After fixing, re-read the original request and verify:** Does the output match what the user asked for? Are the column names exactly as requested? Is the calculation logic correct per the requirements? Did you solve the actual problem, not just make the error go away?
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: debugging-dbt-errors
description: |
  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.

dbt Troubleshooting

Read the full error. Check upstream first. ALWAYS run dbt build after fixing.

Critical Rules

  1. ALWAYS run dbt build after fixing - compile is NOT enough to verify the fix
  2. If fix fails 3+ times, stop and reassess your entire approach
  3. Verify data after build - build passing doesn't mean output is correct

Workflow

1. Get the Full Error

dbt compile --select <model_name>
# or
dbt build --select <model_name>

Read the COMPLETE error message. Note the file, line number, and specific error.

2. Inspect Actual Data (For Data Issues)

Before fixing "wrong output" or "incorrect results", query the actual data:

# 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 10

Understand what's wrong before attempting to fix it.

3. Read Compiled SQL

cat target/compiled/<project>/<path>/<model_name>.sql

See the actual SQL that will run.

4. Analyze Error Type

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

5. Check Upstream Models

# 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

Many errors come from upstream changes, not the current model.

6. Apply Fix

Common fixes:

Error Fix
Column not found Check upstream model's output columns
Ambiguous column Add table alias: table.column
Type mismatch Add explicit CAST()
Division by zero Use NULLIF(divisor, 0)
Jinja error Check matching {{ }} and {% %}

7. Rebuild (MANDATORY)

dbt build --select <model_name>

3-Failure Rule: If build fails 3+ times, STOP. Step back and:

  1. Re-read the original error
  2. Check if your entire approach is wrong
  3. Consider alternative solutions

8. Verify Fix

# Preview the data
dbt show --select <model_name> --limit 10

# Run tests
dbt test --select <model_name>

9. Re-review Logic Against Requirements

After fixing, re-read the original request and verify:

  • Does the output match what the user asked for?
  • Are the column names exactly as requested?
  • Is the calculation logic correct per the requirements?
  • Did you solve the actual problem, not just make the error go away?

10. Check Downstream Impact

# Find downstream models
grep -r "ref('<model_name>')" models/ --include="*.sql"

# Rebuild downstream
dbt build --select <model_name>+

Error Categories

Compilation Errors

  • Check Jinja syntax: matching {{ }} and {% %}
  • Verify macro arguments
  • Check YAML indentation

Database Errors

  • Read compiled SQL in target/compiled/
  • Check column names against upstream
  • Verify data types

Test Failures

  • Read the test SQL to understand what it checks
  • Compare your model output to expected behavior
  • Check column names, data types, NULL handling

Anti-Patterns

  • Making random changes without understanding the error
  • Assuming the current model is wrong before checking upstream
  • Not reading the FULL error message
  • Declaring "fixed" without running build
  • Getting stuck making small tweaks instead of reassessing

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决数据工程中高频刚需问题:dbt错误系统调试
  • 提供具体可执行的故障排除工作流和最佳实践
  • 涵盖编译错误、数据库错误、测试失败等完整错误类型
Trigger Precision88/100

Highlights

  • 触发词覆盖全面:修复、错误、调试、编译失败等常见dbt问题场景
  • 边界清晰,避免与其他技能重叠
Structure and Standards94/100

Highlights

  • 结构完整:包含关键规则、分步工作流、错误分类、反模式
  • 提供具体命令示例和验证机制
  • frontmatter完整规范
Execution Reliability91/100

Highlights

  • 所有命令均为标准dbt CLI工具,参数正确
  • 包含强制验证步骤(dbt build)和失败处理规则(3次失败停止)
  • 提供数据检查方法避免盲目修复
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

After fixing, re-read the original request and verify:** Does the output match what the user asked for? Are the column names exactly as requested? Is the calculation logic correct per the requirements? Did you solve the actual problem, not just make the error go away?

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.