{"record":{"id":"73ab088abb5245be","repo":"dbt-labs/dbt-core","slug":"the-incremental-strategy-strategy-is-not-valid","errorCode":null,"errorMessage":"The incremental strategy '{strategy}' is not valid for ClickHouse.","messagePattern":"The incremental strategy '(.+?)' is not valid for ClickHouse\\.","errorType":"validation","errorClass":"AdapterError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/metadata/clickhouse/mod.rs","lineNumber":900,"sourceCode":"    };\n    strategy.replace('+', \"_\")\n}\n\n/// Mirrors impl.py `validate_incremental_strategy`: ClickHouse-specific\n/// cross-config checks, with Python-exact messages.\npub(crate) fn validate_incremental_strategy(\n    strategy: &str,\n    has_predicates: bool,\n    has_unique_key: bool,\n    has_partition_by: bool,\n    has_lw_deletes: bool,\n) -> AdapterResult<()> {\n    let err = |msg: String| Err(AdapterError::new(AdapterErrorKind::Configuration, msg));\n    if !matches!(\n        strategy,\n        \"legacy\" | \"append\" | \"delete_insert\" | \"insert_overwrite\" | \"microbatch\"\n    ) {\n        return err(format!(\n            \"The incremental strategy '{strategy}' is not valid for ClickHouse.\"\n        ));\n    }\n    if matches!(strategy, \"delete_insert\" | \"microbatch\") && !has_lw_deletes {\n        return err(format!(\n            \"'{strategy}' strategy requires lightweight deletes, but the required setting \\\n             '{ND_MUTATION_SETTING}' could not be enabled on this ClickHouse server \\\n             (see the warnings logged at connection time).\"\n        ));\n    }\n    if matches!(strategy, \"delete_insert\" | \"microbatch\") && !has_unique_key {\n        return err(format!(\n            \"'{strategy}' strategy requires a non-empty 'unique_key'.\"\n        ));\n    }\n    if !matches!(strategy, \"delete_insert\" | \"microbatch\") && has_predicates {\n        return err(format!(\n            \"Cannot apply incremental predicates with '{strategy}' strategy.\"","sourceCodeStart":882,"sourceCodeEnd":918,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/metadata/clickhouse/mod.rs#L882-L918","documentation":"ClickHouse incremental materializations only support the strategies 'legacy', 'append', 'delete_insert', 'insert_overwrite', and 'microbatch'. validate_incremental_strategy rejects any other value at configuration time with a Configuration adapter error. This is an upfront guard so users get a clear message instead of failing mid-run with generated SQL.","triggerScenarios":"Configuring a dbt ClickHouse model with config materialized='incremental' and incremental_strategy set to any string outside the five allowed values (e.g. 'delete+insert', 'merge', 'append_plus', or a strategy copied from another adapter like Snowflake's 'delete+insert' or BigQuery's 'merge').","commonSituations":"Porting a dbt project from another warehouse to ClickHouse without updating incremental_strategy; a typo in the strategy name; following outdated blog posts that predate the current strategy set.","solutions":["Change the model config to one of: legacy, append, delete_insert, insert_overwrite, microbatch","If porting from another adapter, map the strategy to the ClickHouse equivalent (e.g. delete+insert -> delete_insert)","Omit incremental_strategy entirely to use the adapter default"],"exampleFix":"// before\n{{ config(materialized='incremental', incremental_strategy='delete+insert') }}\n// after\n{{ config(materialized='incremental', incremental_strategy='delete_insert') }}","handlingStrategy":"validation","validationCode":"const VALID: &[&str] = &[\"legacy\", \"append\", \"delete_insert\", \"insert_overwrite\", \"microbatch\"];\nassert!(VALID.contains(&cfg.incremental_strategy.as_str()), \"invalid strategy for ClickHouse\");","typeGuard":"fn is_valid_clickhouse_strategy(s: &str) -> bool {\n    matches!(s, \"legacy\" | \"append\" | \"delete_insert\" | \"insert_overwrite\" | \"microbatch\")\n}","tryCatchPattern":null,"preventionTips":["Copy strategy names only from ClickHouse adapter docs","When porting models between warehouses, audit incremental_strategy values","Omit incremental_strategy to accept the adapter default"],"tags":["clickhouse","dbt","configuration","incremental"],"backgroundTag":"invalid-enum-value","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"}