{"record":{"id":"589786bbecf9c447","repo":"dbt-labs/dbt-core","slug":"expected-a-model-node","errorCode":null,"errorMessage":"Expected a model node","messagePattern":"Expected a model node","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/relation/relation_impl.rs","lineNumber":1030,"sourceCode":"        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                )\n            }\n            _ => Err(minijinja::Error::new(\n                minijinja::ErrorKind::InvalidOperation,\n                \"Only available for snowflake\",\n            )),\n        }\n    }\n","sourceCodeStart":1012,"sourceCodeEnd":1048,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/relation/relation_impl.rs#L1012-L1048","documentation":"After the config value successfully deserializes into an InternalDbtNodeWrapper, `dynamic_table_config_changeset` requires it to be the Model variant. Any other node kind (e.g. seed, snapshot, test) hits the catch-all arm and produces this InvalidOperation error. It guards the downstream code that only knows how to build a dynamic-table changeset from a model node.","triggerScenarios":"Invoking dynamic_table_config_changeset from a non-model node context (snapshot, seed, etc.) whose wrapper deserializes as a variant other than InternalDbtNodeWrapper::Model.","commonSituations":"Calling this relation method in a snapshot or seed macro, or reusing model relation macros in custom materializations attached to non-model nodes.","solutions":["Only call dynamic_table_config_changeset from model nodes; remove the call from snapshot/seed contexts.","If you need equivalent behavior for another node type, implement a branch for that wrapper variant instead of forcing it through the model path.","Confirm the config you passed actually corresponds to the model in question, not another node."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"{% if node.resource_type != 'model' %}\n  {{ exceptions.warn('dynamic_table_config_changeset is model-only; skipping') }}\n{% else %}\n  {{ relation.dynamic_table_config_changeset(config) }}\n{% endif %}","typeGuard":"fn is_model_wrapper(w: &InternalDbtNodeWrapper) -> bool {\n    matches!(w, InternalDbtNodeWrapper::Model(_))\n}","tryCatchPattern":"try:\n    relation.dynamic_table_config_changeset(config)\nexcept minijinja.Error as e:\n    if 'Expected a model node' in str(e):\n        skip_changeset()\n    else:\n        raise","preventionTips":["Only call this method inside model materialization macros","Gate calls on node.resource_type == 'model'","Provide separate paths for snapshots/seeds"],"tags":["jinja","adapter","node-type"],"backgroundTag":"incompatible-source-type","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}