{"record":{"id":"f543544a93010554","repo":"dbt-labs/dbt-core","slug":"config-requires-all-arguments-to-be-defined-but","errorCode":null,"errorMessage":"config requires all arguments to be defined, but '{key}' is undefined","messagePattern":"config requires all arguments to be defined, but '(.+?)' is undefined","errorType":"exception","errorClass":"minijinja::Error (InvalidOperation)","httpStatus":null,"severity":"error","filePath":"crates/dbt-jinja-utils/src/phases/parse/resolve_model_context.rs","lineNumber":729,"sourceCode":"                start: dbt_yaml::Marker::new(\n                    start_offset as usize,\n                    start_line as usize,\n                    start_col as usize,\n                ),\n                end: dbt_yaml::Marker::new(\n                    end_offset as usize,\n                    end_line as usize,\n                    end_col as usize,\n                ),\n                filename: self.error_path.as_ref().map(|p| Arc::new(p.to_path_buf())),\n            }\n        };\n\n        let mut mapping = dbt_yaml::Mapping::with_capacity(kwargs.len());\n        for (key, value) in kwargs.into_iter() {\n            if value.is_undefined() {\n                // dbt Core names the key too: `at path ['alias']: Undefined is not valid`\n                return Err(minijinja::Error::new(\n                    minijinja::ErrorKind::InvalidOperation,\n                    format!(\n                        \"config requires all arguments to be defined, but '{key}' is undefined\"\n                    ),\n                ));\n            }\n\n            let value = if let Some(dyn_obj) = value.as_object()\n                && let Some(pydatetime) = dyn_obj.downcast::<PyDateTime>()\n            {\n                dbt_yaml::to_value(pydatetime.chrono_dt())\n            } else {\n                dbt_yaml::to_value(value)\n            }\n            .map_err(|e| {\n                MinijinjaError::new(\n                    MinijinjaErrorKind::InvalidOperation,\n                    format!(\"Failed to serialize config into yaml: {e}\"),","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-jinja-utils/src/phases/parse/resolve_model_context.rs#L711-L747","documentation":"apply_config in the parse-phase model context rejects any config() kwarg whose value is minijinja-undefined. dbt requires every config argument to be a defined value; passing undefined would silently produce a broken config, so the key is reported explicitly (mirroring dbt Core's \"Undefined is not valid\" message).","triggerScenarios":"Calling config(...) in a model/schema file with a variable that is undefined at parse time, e.g. config(alias=var('missing_var')) or config(alias=some_undefined_macro_result).","commonSituations":"var() without a default for a variable not set in dbt_project.yml or --vars; referencing a macro attribute that doesn't exist; env_var lookups or conditionals that evaluate to undefined in one environment.","solutions":["Provide a default for var(): config(alias=var('my_var', 'fallback')).","Check spelling of the config key and of the variable/macro producing the value.","Set the variable via dbt_project.yml vars or --vars flag in the failing environment.","Guard with is defined: {% if x is defined %}{% do config(alias=x) %}{% endif %} or supply a literal fallback."],"exampleFix":"-- before\n{{ config(alias=var('custom_alias')) }}\n-- after\n{{ config(alias=var('custom_alias', this.identifier)) }}","handlingStrategy":"validation","validationCode":"-- Jinja\n{% set alias_val = var('custom_alias', none) %}\n{% if alias_val is none %}\n  {{ exceptions.raise_compiler_error(\"custom_alias is required for this model's config\") }}\n{% else %}\n  {{ config(alias=alias_val) }}\n{% endif %}","typeGuard":null,"tryCatchPattern":"// Rust-side caller of config kwargs\nmatch value.is_undefined() {\n    true => return Err(friendly_undefined_error(key)),\n    false => Ok(()),\n}","preventionTips":["Never call var() without a default for optional configs.","Add schema.yml/dbt_project.yml linting that verifies referenced vars exist per environment.","Test models with `dbt parse` in CI so undefined config args surface before run time."],"tags":["jinja","config","undefined-variable","dbt"],"backgroundTag":"missing-required-config-field","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"}