dbt-labs/dbt-core · error
mock config for adapter type {:?}
Error message
mock config for adapter type {:?} What it means
In the mock/test adapter factory, only a fixed set of adapter types (DuckDB, Snowflake, Postgres, etc.) have mock configurations; for BigQuery, Redshift, Spark, and Databricks an empty config is returned, but for every other adapter type the factory panics with `unimplemented!("mock config for adapter type {:?}")`. This is a test-infrastructure limitation: the mock engine cannot be constructed for adapters no one has configured yet.
Source
Thrown at crates/dbt-adapter/src/adapter/adapter_impl.rs:6036
DuckDB => {
let attach = YmlValue::Sequence(
vec![YmlValue::Mapping(
Mapping::from_iter([
("path".into(), "md:some_db".into()),
("is_ducklake".into(), true.into()),
]),
Default::default(),
)],
Default::default(),
);
Mapping::from_iter([
("path".into(), "md:my_db".into()),
("is_ducklake".into(), true.into()),
("attach".into(), attach),
])
}
Bigquery | Redshift | Spark | Databricks => Mapping::new(),
_ => unimplemented!("mock config for adapter type {:?}", adapter_type),
};
build_engine(adapter_type, config)
}
fn build_engine(adapter_type: AdapterType, config: Mapping) -> Arc<dyn AdapterEngine> {
build_engine_with_behavior(adapter_type, config, BTreeMap::new())
}
fn build_engine_with_behavior(
adapter_type: AdapterType,
config: Mapping,
behavior_flag_overrides: BTreeMap<String, bool>,
) -> Arc<dyn AdapterEngine> {
let auth = auth_for_backend(backend_of(adapter_type));
let resolved_quoting = match adapter_type {
Snowflake => SNOWFLAKE_RESOLVED_QUOTING,
_ => DEFAULT_RESOLVED_QUOTING,
};View on GitHub (pinned to 0267ce9170)
Solutions
- Add a mock config arm for your adapter type in the factory (even an empty `Mapping::new()` like BigQuery/Redshift/Spark/Databricks if no special settings are needed).
- Switch the test to a supported adapter type (e.g. DuckDB or Snowflake) if the adapter specifics are irrelevant to what you're testing.
- If the adapter genuinely can't be mocked, gate the test with an ignore/skip for that adapter type.
Example fix
// before
_ => unimplemented!("mock config for adapter type {:?}", adapter_type),
// after
Athena | Trino => Mapping::new(),
_ => unimplemented!("mock config for adapter type {:?}", adapter_type), Defensive patterns
Strategy: validation
Validate before calling
// Rust, before requesting a mock
const MOCKABLE: &[AdapterType] = &[
AdapterType::DuckDB, AdapterType::Snowflake, AdapterType::Postgres,
AdapterType::Bigquery, AdapterType::Redshift, AdapterType::Spark, AdapterType::Databricks,
];
assert!(MOCKABLE.contains(&adapter_type), "no mock config for {adapter_type:?}"); Type guard
fn mockable(t: AdapterType) -> bool {
matches!(t,
AdapterType::DuckDB | AdapterType::Snowflake | AdapterType::Postgres |
AdapterType::Bigquery | AdapterType::Redshift | AdapterType::Spark | AdapterType::Databricks)
} Try / catch
// Panics are fatal in tests; validate the adapter type when building the harness
let engine = if mockable(adapter_type) { build_mock(adapter_type) } else { panic!("add mock config for {adapter_type:?}") }; Prevention
- Extend the mock factory whenever a new AdapterType variant is added
- Prefer DuckDB/Snowflake mocks when the test is adapter-agnostic
- Keep a list of supported mock adapter types in test helpers documentation
When it happens
Trigger: Requesting a mock adapter engine via `mock_config`/`build_engine` for an adapter type outside the handled set (not DuckDB/Postgres/Snowflake or the explicitly empty-config BigQuery/Redshift/Spark/Databricks set) — typically in unit tests or record/replay harnesses.
Common situations: Writing a new test that instantiates a mock adapter for a less common warehouse (e.g. Athena, Trino, Oracle, ClickHouse); adding a new AdapterType variant and forgetting to extend the mock factory; record-replay tooling encountering an unmocked adapter.
Related errors
- query addition to connection in MockAdapter
- type conversion from table column in MockAdapter
- Trino
- Datafusion
- Dremio
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/75fa98555113eb16.
Report an issue: GitHub.