Reading Errors in Logs, Compiled Code, and YAML
dbt Analytics Engineering · Lesson 11 of 17 · 1:20:26
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the dbt Analytics Engineering Certification exam. In this lesson: runtime, compilation, dependency, and database errors, the logs, compiled and run SQL in the target folder, dbt compile and dbt parse, and YAML errors. Includes three original practice questions, with Orchardline Meal Kits, a fictional meal-kit company, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Three errors on Monday
On Monday morning, Orchardline's runs failed three times: once in a YAML file, once in the warehouse, and once with a cycle in the DAG. Each error message gives a type, a file, and often a line, and knowing where to look saves hours. This lesson covers error messages and logs, compiled code, database errors, and YAML errors.
Error messages and logs
Every dbt error message starts with its type, and names the file where it happened, so read it from top to bottom before changing anything. A runtime error comes first, when dbt checks the project and the connection, like a missing project file, or a profile name that does not match. A compilation error comes from parsing, when a Jinja block or a YAML file is not valid, or when a ref points to a model that does not exist. A dependency error means that the graph has a cycle, and a database error is passed on from the warehouse when the SQL runs. And the dbt dot log file, in the logs folder, keeps every query that dbt ran, with the most recent errors at the bottom.
Compiled code
dbt turns each model into plain SQL, by rendering its Jinja, and writes the result under the target folder. The compiled folder holds the select statement of each model, and the run folder holds the full SQL that dbt executed, like the create table statement around it. dbt compile with the select flag prints the compiled SQL of a model in the terminal, which is the quickest way to check what a macro or a loop produced. You do not need dbt compile before a run, since run and build compile on their own, and dbt parse checks the project without connecting to the warehouse. Never edit the files under target, since dbt overwrites them on the next command: fix the model file instead.
Database errors
A database error is the warehouse rejecting the SQL, and dbt passes its message on, with the path of the compiled SQL under target. Most of the time, the mistake is in the model's own SQL: open the model next to its compiled file, and run the compiled query in a query editor to isolate the problem. But some queries run behind the scenes, like hooks, schema creation, or the merge statements of incremental models and snapshots, and those only appear in the logs. To isolate a strange error, run only the failing model, so that the log file holds only the queries you need.
YAML errors
YAML errors are compilation errors, raised while dbt parses the project, before any model runs. When the file cannot be read at all, the message gives the file and the line, and the cause is usually indentation, like a columns key indented too far. When the YAML is valid, but a key is unknown to dbt, the message says that additional properties are not allowed, and names the unexpected key. Then look for a typo, or a key placed at the wrong level, check the property in the documentation, and check your dbt version if the key is new. Indentation guides in your editor, and dbt parse before you push, catch most of these errors early.
Recap
Let's recap. Every error message gives a type and a file: runtime, compilation, dependency, or database. The dbt dot log file keeps every query, with the latest errors at the bottom. The compiled folder holds the select statements, the run folder holds the SQL that dbt executed, and you never edit either one. Database errors are fixed in the model's SQL, after running the compiled query to isolate them. And YAML errors are either indentation, with a line number, or an unknown key, with additional properties not allowed.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A run stops with Found a cycle: customers → a staging model → customers. What kind of error is it, and what fixes it?
- A database error: fix the SQL syntax of customers
- A runtime error: rename the profile in profiles.yml
- A dependency error: change the ref that loops back
- A compilation error: fix the indentation of the YAML
Show the answer
A dependency error: change the ref that loops back
A cycle is a dependency error, and you break it by changing the ref that points back upstream. “A database error: fix the SQL syntax of customers” is wrong, since the warehouse never ran any SQL. “A runtime error: rename the profile in profiles.yml” is wrong, since the profile only concerns the connection. And “A compilation error: fix the indentation of the YAML” is wrong, since no YAML file is involved in a cycle.
A developer fixes a typo directly in the compiled file under target, then runs the model with dbt run. What happens?
- dbt compiles the model again, and the typo comes back
- dbt runs the edited compiled file, so the model builds
- dbt copies the fix back into the model file
- dbt refuses to run until the target folder is cleaned
Show the answer
dbt compiles the model again, and the typo comes back
Dbt compiles the model file again on every command, so the edit under target is overwritten, and the typo comes back. “dbt runs the edited compiled file, so the model builds” is wrong, since dbt never runs an old compiled file. “dbt copies the fix back into the model file” is wrong, since dbt never writes back into your model files. And “dbt refuses to run until the target folder is cleaned” is wrong, since dbt simply overwrites the target folder.
dbt parse fails with mapping values are not allowed in this context, at line 12 of _orders.yml. What is the most likely fix?
- Rename the key that dbt does not recognize
- Run dbt deps to reinstall the packages
- Add a data_type to each column of the model
- Fix the indentation around line 12
Show the answer
Fix the indentation around line 12
This message comes from the YAML parser, which cannot read the file, and the cause is usually indentation near the given line. “Rename the key that dbt does not recognize” would only fix valid YAML with a key unknown to dbt, which gives a different message. “Run dbt deps to reinstall the packages” is wrong, since packages have nothing to do with this file. And “Add a data_type to each column of the model” is wrong, since data types matter only for contracts.