{"record":{"id":"75fa98555113eb16","repo":"dbt-labs/dbt-core","slug":"mock-config-for-adapter-type","errorCode":null,"errorMessage":"mock config for adapter type {:?}","messagePattern":"mock config for adapter type (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/adapter_impl.rs","lineNumber":6036,"sourceCode":"            DuckDB => {\n                let attach = YmlValue::Sequence(\n                    vec![YmlValue::Mapping(\n                        Mapping::from_iter([\n                            (\"path\".into(), \"md:some_db\".into()),\n                            (\"is_ducklake\".into(), true.into()),\n                        ]),\n                        Default::default(),\n                    )],\n                    Default::default(),\n                );\n                Mapping::from_iter([\n                    (\"path\".into(), \"md:my_db\".into()),\n                    (\"is_ducklake\".into(), true.into()),\n                    (\"attach\".into(), attach),\n                ])\n            }\n            Bigquery | Redshift | Spark | Databricks => Mapping::new(),\n            _ => unimplemented!(\"mock config for adapter type {:?}\", adapter_type),\n        };\n        build_engine(adapter_type, config)\n    }\n\n    fn build_engine(adapter_type: AdapterType, config: Mapping) -> Arc<dyn AdapterEngine> {\n        build_engine_with_behavior(adapter_type, config, BTreeMap::new())\n    }\n\n    fn build_engine_with_behavior(\n        adapter_type: AdapterType,\n        config: Mapping,\n        behavior_flag_overrides: BTreeMap<String, bool>,\n    ) -> Arc<dyn AdapterEngine> {\n        let auth = auth_for_backend(backend_of(adapter_type));\n        let resolved_quoting = match adapter_type {\n            Snowflake => SNOWFLAKE_RESOLVED_QUOTING,\n            _ => DEFAULT_RESOLVED_QUOTING,\n        };","sourceCodeStart":6018,"sourceCodeEnd":6054,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/adapter_impl.rs#L6018-L6054","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n_ => unimplemented!(\"mock config for adapter type {:?}\", adapter_type),\n// after\nAthena | Trino => Mapping::new(),\n_ => unimplemented!(\"mock config for adapter type {:?}\", adapter_type),","handlingStrategy":"validation","validationCode":"// Rust, before requesting a mock\nconst MOCKABLE: &[AdapterType] = &[\n    AdapterType::DuckDB, AdapterType::Snowflake, AdapterType::Postgres,\n    AdapterType::Bigquery, AdapterType::Redshift, AdapterType::Spark, AdapterType::Databricks,\n];\nassert!(MOCKABLE.contains(&adapter_type), \"no mock config for {adapter_type:?}\");","typeGuard":"fn mockable(t: AdapterType) -> bool {\n    matches!(t,\n        AdapterType::DuckDB | AdapterType::Snowflake | AdapterType::Postgres |\n        AdapterType::Bigquery | AdapterType::Redshift | AdapterType::Spark | AdapterType::Databricks)\n}","tryCatchPattern":"// Panics are fatal in tests; validate the adapter type when building the harness\nlet engine = if mockable(adapter_type) { build_mock(adapter_type) } else { panic!(\"add mock config for {adapter_type:?}\") };","preventionTips":["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"],"tags":["unimplemented","mock","testing","adapter"],"backgroundTag":"method-not-implemented","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}