Skip to content

[Feature] Clarify error when file(s) contain duplicate macros #1648

@dbeatty10

Description

@dbeatty10

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

I was chatting with @gwenwindflower yesterday about dbt-labs/dbt-core#10387 being resolved in #1631 🎉

She had some good insight that there's still some some ambiguity remaining:

"dbt found multiple macros named "{self.macro.name}" in the project"

"To fix this error, rename or remove one of the following macros.
     They can be found in these files:"

(emphasis mine)

Great changes, but if the goal is making it clear that there can be n duplicates and any duplicates will error, that language is specifically the solution for n = 2. Should probably read something like "All macros require unique names, to fix this error rename or remove any duplicates."

Current

dbt found multiple macros named "{self.macro.name}" in the project
To fix this error, rename or remove one of the following macros.
     They can be found in these files:
     - /path/to/file1.sql
     - /path/to/file2.sql
     - /path/to/file3.sql
     - ...
     - /path/to/filex.sql

Suggested

All macros require unique names, but dbt found multiple macros named "{self.macro.name}" in the project.
To fix this error, rename or remove any duplicates.
     Duplicates can be found in these file(s):
     - /path/to/file1.sql
     - /path/to/file2.sql
     - /path/to/file3.sql
     - ...
     - /path/to/filex.sql

Alternatives

Or a variant of one of these original suggestions:

dbt found multiple macros named "cents_to_dollars" in the project "jaffle shop".
To fix this error, rename or remove duplicates. They can be found in these files:
  - macros/hi_doug.sql
  - macros/hi_jer.sql
dbt found multiple macros named "cents_to_dollars" in the project "jaffle shop".
To fix this error, rename or remove duplicates. They can be found in this file:
  - macros/cents_to_dollars.sql

Describe alternatives you've considered

Minimal alternative

Here's the smallest change that could possibly work:

Change this:

"To fix this error, rename or remove one of the following macros.

to this:

"To fix this error, rename or remove duplicated macros.

Who will this benefit?

No response

Are you interested in contributing this feature?

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions