Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise a better error message if dbt parses the same file twice due to misconfiguration #2449

Closed
drewbanin opened this issue May 14, 2020 · 0 comments · Fixed by #3165
Closed
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Milestone

Comments

@drewbanin
Copy link
Contributor

Describe the feature

If a macro is addressed twice in a dbt project, then dbt will fail to compile with:

Compilation Error
  dbt found two macros named "<macro name>" in the project "projectname".
   To fix this error, rename or remove one of the following macros:
      - dbt_modules/package/macros/my_macro.sql
      - dbt_modules/package/macros/my_macro.sql

This is confusing because there is actually on a single file and the macro is not defined twice, dbt just doesn't recognize that it has already parsed the file.

The root cause of an error like this is a misconfiguration like:

macro-paths: [macros, dbt_modules/package/macros]

Instead, dbt should raise the following error if a file is parsed twice in parsing:

Compilation Error
  The file <filepath> was parsed multiple times by dbt.
  This error happens when a path is duplicated in a dbt_project.yml configuration.
  Check your `dbt_project.yml` file path configurations and remove any
  duplicated paths to fix this error.

Describe alternatives you've considered

We could optionally allow the duplicate paths, raise a warning, and continue on. I'm amenable to that, but I don't think there's any real merit to supporting it!

Who will this benefit?

Clearer error messages are good for everyone

@drewbanin drewbanin added the enhancement New feature or request label May 14, 2020
@drewbanin drewbanin added this to the Marian Anderson milestone May 14, 2020
@jtcohen6 jtcohen6 added the good_first_issue Straightforward + self-contained changes, good for new contributors! label Jul 6, 2020
@jtcohen6 jtcohen6 removed this from the Marian Anderson milestone Jul 6, 2020
@jtcohen6 jtcohen6 added this to the Margaret Mead milestone Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants