--profiles-dir fails for dbt test and dbt compile

I have a profiles/profiles.yml under my dbt project. I am able to do dbt run --profiles-dir ./profiles, it’ll successfully create tables at the specified location. However, when I run dbt test --profiles-dir ./profiles or dbt compile --profiles-dir ./profiles, it fails with the following error message.

14:33:58  Encountered an error while reading the project:
14:33:58    ERROR: Runtime Error
  Could not find profile named 'avr_heor'

I also tried running dbt debug --profiles-dir ./profiles, everything is ok.

My dbt version:

Core:
  - installed: 1.2.1
  - latest:    1.2.2 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - bigquery:  1.2.0 - Up to date!
  - snowflake: 1.2.0 - Up to date!
  - redshift:  1.2.1 - Up to date!
  - postgres:  1.2.1 - Update available!

I’m not sure - the fact that it works in run and debug but not other commands is very strange. I’d suggest opening an issue about this: Issues · dbt-labs/dbt-core · GitHub