MetricSign
Start free
High severitycompilationdbt Cloud

dbt Error:
SourceNotFoundError

What does this error mean?

A dbt model references a source using source() but the source is not defined in any sources.yml file in the project. dbt cannot compile the model.

Common causes

  • 1The source was defined in a package that is not installed (run dbt deps)
  • 2The sources.yml file was deleted or the source definition was removed
  • 3The source name or table name in the source() call doesn't match the definition in sources.yml
  • 4The sources.yml file is in a directory not included in the model paths
  • 5A typo in the source name or table name in the source() macro call

How to fix it

  1. 1Search for the source definition across all YAML files: grep -r 'source_name' . --include='*.yml' — confirm the source name and table name are defined.
  2. 2Verify the source() call arguments match the definition exactly, including case: source('source_name', 'table_name').
  3. 3Run dbt deps if the source is defined in a package — the package must be installed before dbt can resolve it.
  4. 4Check that the sources.yml file is in a directory included in the dbt project's model-paths configuration.
  5. 5Run dbt parse to get the full compilation error with the file path and line number where the undefined source is referenced.

Frequently asked questions

Can a source be defined in multiple YAML files?

Each source name must be unique per schema. You can split source definitions across multiple files as long as the source names are unique.

How do I list all defined sources in my dbt project?

Run: dbt ls --resource-type source. This lists all sources defined in the project.

Source · docs.getdbt.com/reference/exceptions

Other compilation errors