elementary.exceptions.exceptions.DbtCommandError: ...
# ask-elementary-ai
n
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command. Runtime Error Could not find profile named 'elementary'
k
A message from kapa.ai
The error message:
Copy code
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command. Runtime Error   Could not find profile named 'elementary'
means that the Elementary CLI is unable to find a dbt profile named elementary in your profiles.yml file. This is a common setup issue when using Elementary. How to resolve: 1. Ensure your profiles.yml contains an elementary profile. Your profiles.yml should have a top-level key named elementary, with the appropriate connection details. For example:
Copy code
yaml    elementary:      outputs:        default:          type: bigquery          method: service-account          project: [GCP project id]          dataset: [the name of your dbt dataset]          threads: [1 or more]          keyfile: [/path/to/bigquery/keyfile.json]      target: default
Replace the values with your actual connection details. The key is that the profile name must be elementary, not your dbt project name or anything else. [See example and discussion](https://slack.com/archives/C02CTC89LAX/p1679232209390069) 2. Check the location of your profiles.yml. By default, dbt and Elementary look for profiles.yml in the user home directory (
~/.dbt/
). If your file is elsewhere, use the
--profiles-dir
flag to specify the path:
Copy code
edr report --profiles-dir /path/to/your/profiles
[See troubleshooting advice](https://slack.com/archives/C02CTC89LAX/p1679232209390069) 3. Do not use your main dbt project profile for Elementary. You need a dedicated elementary profile, even if the connection details are similar to your main dbt project. [See explanation](https://slack.com/archives/C02CTC89LAX/p1686013979045139) 4. If using service accounts or key files, use absolute paths. For BigQuery, the keyfile path should be absolute, not relative, especially in some versions of Elementary. [See version-specific advice](https://github.com/elementary-data/elementary/issues/1702) Summary: This error is almost always due to the absence or misplacement of the elementary profile in your profiles.yml, or not pointing Elementary to the correct profiles directory. Double-check your configuration and the path you provide to the CLI. If you continue to have issues, please share your profiles.yml (with sensitive info redacted) and the exact command you are running.
n
@kapa.ai
Copy code
f2025-08-15 19:21:49 — INFO — Running with edr=0.19.4
2025-08-15 19:21:49 — DEBUG — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_latest_invocation", "macro_args": {}} --project-dir airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/dbt_project --profiles-dir airflow-dags/dags/analytics/profiles.yml
[31;20m2025-08-15 19:21:49 — ERROR — Unable to get the latest invocation: Failed to run dbt command.
Runtime Error
  Could not find profile named 'elementary'[0m
2025-08-15 19:21:49 — DEBUG — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_adapter_type_and_unique_id", "macro_args": {}} --project-dir airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/dbt_project --profiles-dir airflow-dags/dags/analytics/profiles.yml
2025-08-15 19:21:50 — DEBUG — Could not get warehouse info.
Traceback (most recent call last):
  File " airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/data_monitoring/data_monitoring.py", line 140, in _get_warehouse_info
    self.internal_dbt_runner.run_operation(
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 177, in run_operation
    result = self._run_command(
             ^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 114, in _run_command
    result = self._inner_run_command(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/clients/dbt/api_dbt_runner.py", line 54, in _inner_run_command
    raise DbtCommandError(
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command.
Runtime Error
  Could not find profile named 'elementary'
2025-08-15 19:21:50 — DEBUG — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_elementary_database_and_schema", "macro_args": {}} --project-dir airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/dbt_project --profiles-dir airflow-dags/dags/analytics/profiles.yml
[31;20m2025-08-15 19:21:51 — ERROR — Failed to parse Elementary's database and schema.[0m
2025-08-15 19:21:51 — INFO — Running dbt command --log-format json run-operation elementary.log_macro_results --args {"macro_name": "elementary_cli.get_test_results", "macro_args": {"days_back": 7, "invocations_per_test": 720, "disable_passed_test_metrics": false}} --project-dir airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/dbt_project --profiles-dir airflow-dags/dags/analytics/profiles.yml
[31;20m2025-08-15 19:21:51 — ERROR — Could not generate the report - Error: Failed to run dbt command.
Runtime Error
  Could not find profile named 'elementary'
Please reach out to our community for help with this issue.[0m
Traceback (most recent call last):
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/api/report/report.py", line 84, in get_report_data
    tests_api = TestsAPI(
                ^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/api/tests/tests.py", line 52, in __init__
    self.test_results_db_rows = self._get_test_results_db_rows(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/api/tests/tests.py", line 64, in _get_test_results_db_rows
    return self.tests_fetcher.get_all_test_results_db_rows(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/monitor/fetchers/tests/tests.py", line 26, in get_all_test_results_db_rows
    run_operation_response = self.dbt_runner.run_operation(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 177, in run_operation
    result = self._run_command(
             ^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/clients/dbt/command_line_dbt_runner.py", line 114, in _run_command
    result = self._inner_run_command(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "airflow-dags/venv/lib/python3.12/site-packages/elementary/clients/dbt/api_dbt_runner.py", line 54, in _inner_run_command
    raise DbtCommandError(
elementary.exceptions.exceptions.DbtCommandError: Failed to run dbt command.
Runtime Error
  Could not find profile named 'elementary'
k
A message from kapa.ai
The error message you're seeing:
Copy code
Runtime Error   Could not find profile named 'elementary'
means that the Elementary CLI is unable to locate a dbt profile named elementary in the profiles.yml file you specified with
--profiles-dir airflow-dags/dags/analytics/profiles.yml
. Key troubleshooting steps based on the knowledge sources: 1. The --profiles-dir flag expects a directory, not a file. You are passing the path to the profiles.yml file itself, but the flag should point to the directory containing profiles.yml. For example, if your profiles.yml is at
airflow-dags/dags/analytics/profiles.yml
, you should run:
Copy code
edr report --profiles-dir airflow-dags/dags/analytics/
This is a common source of this error and is confirmed in multiple support threads and documentation. The CLI looks for a file named profiles.yml inside the directory you specify, not for a file directly. [See this Slack thread for confirmation](https://slack.com/archives/C02CTC89LAX/p1678710882384149) and [another example](https://slack.com/archives/C02CTC89LAX/p1679688978907599). 2. Ensure your profiles.yml contains a profile named elementary. The file should have a top-level key elementary, not your dbt project name or anything else. For example:
Copy code
yaml    elementary:      outputs:        default:          type: [your warehouse type]          # ... other connection details ...      target: default
[See example and explanation](https://slack.com/archives/C02CTC89LAX/p1686013979045139). 3. If you use service account files (e.g., BigQuery), use absolute paths for keyfile. Relative paths can sometimes cause issues, so try using the full path if you encounter errors related to keyfile not found. [See this issue for details](https://github.com/elementary-data/elementary/issues/1702). Summary of what to do: - Change your command to use the directory, not the file:
Copy code
edr report --profiles-dir airflow-dags/dags/analytics/
- Double-check that your profiles.yml contains a profile named elementary. If you follow these steps and still see the error, please double-check the contents of your profiles.yml and ensure there are no indentation or naming issues. Let me know if you need further help!
n
@kapa.ai
Copy code
analytics:
  target: dev
  outputs:
    dev:
      type: clickhouse
      threads: 1
      cluster_mode: False
      host: 1234
      port: 9000
      user: user
      schema: elementary
      password: 
      driver: http
      secure: true
      verify: false
      allow_automatic_deduplication: True
      receive_timeout: 1200


elementary:
  outputs:
    default:
      type: clickhouse
      host: 1234
      port: 9000
      user: user
      password: ""
      database: elementary
      schema: elementary
      threads: 1
      cluster_mode: False
      driver: http
      secure: true
      verify: false
      allow_automatic_deduplication: True
      receive_timeout: 1200
    target: default
validate my profiles
k
A message from kapa.ai
New message text here
n
@kapa.ai wrote me correct profile.yml
k
A message from kapa.ai
New message text here