{"record":{"id":"085473872e87f717","repo":"dbt-labs/dbt-core","slug":"get-view-options-failed-to-deserialize-internaldb","errorCode":null,"errorMessage":"get_view_options: Failed to deserialize InternalDbtNodeWrapper: {e}","messagePattern":"get_view_options: Failed to deserialize InternalDbtNodeWrapper: (.+?)","errorType":"exception","errorClass":"minijinja::Error::SerdeDeserializeError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/mod.rs","lineNumber":2152,"sourceCode":"        match &self.inner {\n            Typed { adapter, .. } => {\n                let iter = ArgsIter::new(\"get_view_options\", &[\"config\", \"node\"], args);\n                let config_val = iter.next_arg::<&Value>()?;\n                let node_val = iter.next_arg::<&Value>()?;\n                iter.finish()?;\n\n                let config = minijinja_value_to_typed_struct::<ModelConfig>(config_val.clone())\n                    .map_err(|e| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::SerdeDeserializeError,\n                            format!(\"get_view_options: Failed to deserialize config: {e}\"),\n                        )\n                    })?;\n                let node = minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(\n                    node_val.clone(),\n                )\n                .map_err(|e| {\n                    minijinja::Error::new(\n                        minijinja::ErrorKind::SerdeDeserializeError,\n                        format!(\n                            \"get_view_options: Failed to deserialize InternalDbtNodeWrapper: {e}\"\n                        ),\n                    )\n                })?;\n\n                let inner_node = node.as_internal_node();\n                let options = adapter.get_view_options(state, config, inner_node.common())?;\n                Ok(Value::from_serialize(options))\n            }\n            Parse(_) => Ok(none_value()),\n        }\n    }\n\n    #[tracing::instrument(skip(self, state), level = \"trace\")]\n    pub fn get_common_options(\n        &self,","sourceCodeStart":2134,"sourceCodeEnd":2170,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/mod.rs#L2134-L2170","documentation":"Same failure mode as the get_table_options node error but raised from get_view_options(): the `node` argument cannot be converted from a minijinja Value into InternalDbtNodeWrapper. The library raises this because the view-options logic needs structured node metadata (schema, database, aliases) and the supplied value is not a valid node object.","triggerScenarios":"adapter.get_view_options(config, node) invoked with a node that is missing required wrapper fields, is None/undefined, is a scalar, or was constructed from a different node schema version.","commonSituations":"Custom view materializations passing `this` or a relation instead of the node dict; macros refactored to pass different context variables; tests building partial node dicts.","solutions":["Check the appended serde message for the exact missing/mistyped node field.","Pass the model node object from the materialization context (e.g. `model`) as the second argument.","Ensure the node dict contains all fields required by InternalDbtNodeWrapper (common metadata, config, etc.).","Keep macro templates and the adapter crate on matching versions to avoid schema drift."],"exampleFix":"// before\n{% do adapter.get_view_options(config.model, this) %}\n\n// after\n{% do adapter.get_view_options(config.model, model) %}","handlingStrategy":"validation","validationCode":"{% if model is mapping and model.get('unique_id') is defined %}\n  {% do adapter.get_view_options(config.model, model) %}\n{% else %}\n  {{ exceptions.raise_compiler_error(\"get_view_options requires a valid node object\") }}\n{% endif %}","typeGuard":"fn is_node(val: &minijinja::Value) -> bool {\n    minijinja_value_to_typed_struct::<InternalDbtNodeWrapper>(val.clone()).is_ok()\n}","tryCatchPattern":null,"preventionTips":["Pass `model` (the node) rather than `this` or a relation","Avoid partial node dicts in tests — serialize full InternalDbtNodeWrapper objects","Version-lock templates with adapter changes"],"tags":["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-14T16:17:12.679Z"}