{"record":{"id":"231a25cb9b2d170c","repo":"dbt-labs/dbt-core","slug":"failed-to-deserialize-internaldbtnodewrapper-e","errorCode":null,"errorMessage":"Failed to deserialize InternalDbtNodeWrapper: {e}","messagePattern":"Failed to deserialize InternalDbtNodeWrapper: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/relation/relation_impl.rs","lineNumber":1022,"sourceCode":"            (_, _) => false,\n        }\n    }\n\n    // https://github.com/dbt-labs/dbt-adapters/blob/292d17301eff3c8a972fcd57f7deb3aac4c8a3cb/dbt-snowflake/src/dbt/adapters/snowflake/relation.py#L92\n    fn dynamic_table_config_changeset(\n        &self,\n        relation_results_value: &Value,\n        relation_config_value: &Value,\n    ) -> Result<Value, minijinja::Error> {\n        match self.adapter_type {\n            AdapterType::Snowflake => {\n                // TODO(serramatutu): minijinja_value_to_typed_struct does not work with references, so we\n                // have to clone the value here...\n                let local_config = minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(\n                    relation_config_value.clone(),\n                )\n                .map_err(|e| {\n                    minijinja::Error::new(\n                        minijinja::ErrorKind::SerdeDeserializeError,\n                        format!(\"Failed to deserialize InternalDbtNodeWrapper: {e}\"),\n                    )\n                })?;\n                let local_config = match local_config {\n                    InternalDbtNodeWrapper::Model(model) => model,\n                    _ => {\n                        return Err(minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"Expected a model node\",\n                        ));\n                    }\n                };\n\n                dynamic_table_config_changeset_from_local_config(\n                    local_config.as_ref(),\n                    relation_results_value,\n                )","sourceCodeStart":1004,"sourceCodeEnd":1040,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/relation/relation_impl.rs#L1004-L1040","documentation":"This error is raised in `dynamic_table_config_changeset` when `minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>` fails to deserialize the relation's config value into an InternalDbtNodeWrapper. The library wraps deserialization failures with this message so Jinja-level callers get a SerdeDeserializeError instead of a panic. It means the config value passed from the model context does not match the expected internal node schema.","triggerScenarios":"Calling the relation's `dynamic_table_config_changeset` Jinja method with a `config` value that is not a valid serialized InternalDbtNode (e.g. a dict missing required fields, wrong field types, or a wrapper for a different node kind).","commonSituations":"Model configs with fields typed differently from the NodeConfig struct (e.g. strings where integers are expected), passing a raw relation config instead of the full node config, or schema drift between the adapter crate and the node definitions after a version upgrade.","solutions":["Inspect the nested error text (`{e}`) to find which field failed to deserialize and fix the model config value accordingly.","Verify you are passing the model's full config (node config) and not an unrelated object into dynamic_table_config_changeset.","Ensure the adapter crate and dbt node schema versions match; upgrade or pin the adapter to your dbt version.","Check that the config value is a Model node wrapper (InternalDbtNodeWrapper::Model) and not another node variant."],"exampleFix":"// before\nrelations.dynamic_table_config_changeset(config.model_config_dict)\n// after\nrelations.dynamic_table_config_changeset(config)","handlingStrategy":"try-catch","validationCode":"// In Jinja, check config is a node config object before calling\nif config is not mapping:\n    raise Exception('config must be the model config object')","typeGuard":"fn is_model_wrapper(v: &Value) -> bool {\n    minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(v.clone())\n        .map(|w| matches!(w, InternalDbtNodeWrapper::Model(_)))\n        .unwrap_or(false)\n}","tryCatchPattern":"match minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(value) {\n    Ok(w) => use(w),\n    Err(e) => log_error_and_skip(format!(\"bad config: {e}\")),\n}","preventionTips":["Always pass the node's `config` object, never a hand-built dict","Keep adapter and dbt-core schema versions in lockstep","Log the full serde error to spot the failing field quickly"],"tags":["serde","deserialization","jinja","adapter"],"backgroundTag":"schema-validation-failed","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"}