The DAG fails to load with this error from Cosmos:

cosmos.exceptions.CosmosValueError: RenderConfig.dbt_executable_path is set, but it is not the same as the system dbt executable path. Do not set render_config.dbt_executable_path when using InvocationMode.DBT_RUNNER.

It appears when RenderConfig points at a dbt installed outside the Airflow environment, usually in its own virtual environment, while the invocation mode is left at its default.

Copy and paste

Fix 1: set the path only on ExecutionConfig. This is enough when dbt is not installed in the Airflow environment:

from cosmos import DbtTaskGroup, ExecutionConfig, ProjectConfig, RenderConfig

DbtTaskGroup(
    group_id="dbt",
    project_config=ProjectConfig("/opt/dbt/shop"),
    profile_config=profile_config,
    execution_config=ExecutionConfig(dbt_executable_path="/opt/dbt/venv/bin/dbt"),
    render_config=RenderConfig(select=["tag:daily"]),   # no dbt_executable_path here
)

Fix 2: keep the path on RenderConfig and switch to subprocess:

from cosmos import ExecutionConfig, RenderConfig
from cosmos.constants import InvocationMode

DBT_BIN = "/opt/dbt/venv/bin/dbt"

render_config = RenderConfig(
    dbt_executable_path=DBT_BIN,
    invocation_mode=InvocationMode.SUBPROCESS,
)
execution_config = ExecutionConfig(
    dbt_executable_path=DBT_BIN,
    invocation_mode=InvocationMode.SUBPROCESS,
)

Why it happens

When Airflow parses the DAG file, Cosmos runs dbt ls to list the models. RenderConfig controls how: its invocation_mode defaults to InvocationMode.DBT_RUNNER, which calls dbt through its Python API inside the Airflow process. That can only use the dbt installed in the Airflow environment, so Cosmos refuses a RenderConfig.dbt_executable_path that differs from the dbt found on the PATH. With dbt in a separate virtual environment that is not on the PATH, any explicit path triggers the error.

Which fix to use

More on the configuration in how to run dbt models as Airflow tasks with Cosmos.

Reproduced and fixed with Cosmos 1.15.1 on Airflow 3.3.2.

References