MetricSign
EN|NLRequest Access
Medium severitycompilation

Power BI Refresh Error:
DbtGenericTestClassNotFound

What does this error mean?

dbt cannot find the Python class implementing a custom generic test, either because the test class was not registered in the project or a required package providing the test is not installed.

Common causes

  • 1A custom generic test references a Python class that was not created in the dbt project macros or tests directory
  • 2The package providing the custom test (e.g., dbt-utils, dbt-expectations) is listed in packages.yml but dbt deps was not run
  • 3The test was moved to a different package namespace and the test configuration was not updated
  • 4A refactoring removed the test class file without updating all sources.yml and schema.yml references

How to fix it

  1. 1Step 1: Run dbt deps to ensure all packages in packages.yml are installed.
  2. 2Step 2: Search the project for the test name in macros/ and tests/generic/ directories to confirm the class file exists.
  3. 3Step 3: Check the package namespace — tests from dbt-utils use dbt_utils.<test_name> syntax.
  4. 4Step 4: If the test is custom, recreate the test macro in the tests/generic/ directory following the dbt generic test interface.
  5. 5Step 5: Run dbt compile to verify the test can be resolved before running dbt test.

Frequently asked questions

Where should I store custom generic tests in a dbt project?

Place custom generic test macros in the tests/generic/ directory (dbt Core 1.0+) or in the macros/ directory (legacy). The file must define a macro with the test name using the Jinja test interface.

Can I use dbt-expectations tests without modifying packages.yml?

No — dbt-expectations must be added to packages.yml and installed with dbt deps before its tests are available. The package provides generic tests like expect_column_values_to_be_between.

Other compilation errors