{"record":{"id":"ef8d7de0bd629d95","repo":"dbt-labs/dbt-core","slug":"unknown-method-on-varprovider-method","errorCode":null,"errorMessage":"Unknown method on VarProvider: '{method}'","messagePattern":"Unknown method on VarProvider: '(.+?)'","errorType":"validation","errorClass":"minijinja::Error","httpStatus":null,"severity":"error","filePath":"crates/dbt-schemas/src/state.rs","lineNumber":1296,"sourceCode":"impl Object for VarProvider {\n    fn call_method(\n        self: &Arc<Self>,\n        _state: &minijinja::State<'_, '_>,\n        method: &str,\n        args: &[minijinja::Value],\n        _listeners: &[std::rc::Rc<dyn minijinja::listener::RenderingEventListener>],\n    ) -> Result<minijinja::Value, minijinja::Error> {\n        match method {\n            \"to_dict\" => {\n                if !args.is_empty() {\n                    return Err(minijinja::Error::new(\n                        minijinja::ErrorKind::TooManyArguments,\n                        \"to_dict() takes no arguments\",\n                    ));\n                }\n                Ok(minijinja::Value::from(self.0.clone()))\n            }\n            _ => Err(minijinja::Error::new(\n                minijinja::ErrorKind::UnknownMethod,\n                format!(\"Unknown method on VarProvider: '{method}'\"),\n            )),\n        }\n    }\n}\n/// Represents the status of a model\n#[derive(Debug, Clone, PartialEq, Copy)]\npub enum ModelStatus {\n    /// Model is enabled and successfully parsed\n    Enabled,\n    /// Model is disabled by configuration\n    Disabled,\n    /// Model failed to parse\n    ParsingFailed,\n}\n\n#[cfg(test)]","sourceCodeStart":1278,"sourceCodeEnd":1314,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-schemas/src/state.rs#L1278-L1314","documentation":"The VarProvider minijinja method dispatcher only implements 'to_dict'; every other method name falls into the `_` catch-all arm which raises ErrorKind::UnknownMethod with the requested name interpolated. Any method call other than to_dict() on this object is rejected at template render time.","triggerScenarios":"Calling any method other than `to_dict()` on a VarProvider value from a minijinja template, e.g. `var_provider.get('my_var')` or `var_provider.keys()` — typo'd names like `to_dicts` also land here.","commonSituations":"Template code assuming VarProvider is a full dict/object with dict methods (get, keys, items); typos in method names; API changes where a method was removed or renamed.","solutions":["Check the method name against the implemented set in the match — only `to_dict` exists","Use `var_provider.to_dict()` and then use standard Jinja dict operations on the result","Add the desired method to the match arm in state.rs if the object should support it"],"exampleFix":"// before (template)\n{% set my_var = var_provider.get('my_var') %}\n// after\n{% set all_vars = var_provider.to_dict() %}\n{% set my_var = all_vars.get('my_var') %}","handlingStrategy":"type-guard","validationCode":"// In template: check the method exists before use\n// {% if var_provider.to_dict is defined %}...{% endif %}\n// In Rust, whitelist allowed method names before dispatch:\nconst METHODS: &[&str] = &[\"to_dict\"];\nassert!(METHODS.contains(&method), \"unsupported method: {method}\");","typeGuard":"fn is_supported_var_provider_method(method: &str) -> bool {\n    matches!(method, \"to_dict\")\n}","tryCatchPattern":"match result {\n    Err(e) if e.kind() == minijinja::ErrorKind::UnknownMethod => {\n        // fall back to var_provider.to_dict() and dict access\n    }\n    other => other?,\n}","preventionTips":["Only call to_dict() on VarProvider values; use plain Jinja dict operations afterward","Watch for typos: to_dict vs to_dicts vs as_dict","When the provider gains new methods, keep the match arm in state.rs as the source of truth"],"tags":["minijinja","template","varprovider","unknown-method"],"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-17T15:17:12.973Z"}