schema yaml for macro complaining two macros with the same name

The problem I’m having

When adding two entries of macros in property.yml, dbt compile has the following complain:

02:17:51  Encountered an error:
Compilation Error
  dbt found two macros named "macro2" in the project "xxx".
   To fix this error, rename or remove one of the following macros:
      - macros/utils/a_file_with_2_macros_defined.sql
      - macros/utils/a_file_with_2_macros_defined.sql

The context of why I’m trying to do this

Initially there was only 1 macro macro1 defined in macros/utils/a_file_with_2_macros_defined.sql and the property.yml is like below and everything works just fine.

version: 2

macros:
  - name: macro1
    description: ""
    arguments: ""

Then I added an additional macro macro2 to the same sql file and the property.yml file is changed to something below. But dbt compile starts to pop up the complains. If I remove the entry from property.yml file, everything works just fine and the data model consuming the new macro also works fine.

Anyone has any clue on what’s going on here? I’m pretty sure I don’t have two macros with the same name in my project.

version: 2

macros:
  - name: macro1
    description: ""
    arguments: ""
  - name: macro2
    description: ""
    arguments: ""

Have the same issue. Remove everything in the target directory. That might help.

Has anyone found a sustainable solution to this problem? It’s annoying that basically every time I edit a test in a schema.yml file and rerun it, I have to first delete the target directory so that dbt doesn’t raise this error.