{"record":{"id":"8a25b0ff0053ba04","repo":"dbt-labs/dbt-core","slug":"set-strict-requires-exactly-1-argument","errorCode":null,"errorMessage":"set_strict requires exactly 1 argument","messagePattern":"set_strict requires exactly 1 argument","errorType":"validation","errorClass":"InvalidOperation","httpStatus":null,"severity":"error","filePath":"crates/dbt-jinja-utils/src/functions/base.rs","lineNumber":767,"sourceCode":"        Ok(Value::from(rendered))\n    }\n}\n\n/// Strict version of set() that fails if the input is not iterable.\n///\n/// Args:\n///     value: An iterable value to convert to a set\n///\n/// Example:\n/// ```jinja\n/// {% set my_list = [1, 2, 2, 3] %}\n/// {% set unique_values = set_strict(my_list) %}\n/// -- Returns [1, 2, 3] or fails if my_list is not iterable\n/// ```\npub fn set_strict_fn() -> impl Fn(&[Value], Kwargs) -> Result<Value, Error> {\n    move |args: &[Value], _kwargs: Kwargs| -> Result<Value, Error> {\n        if args.len() != 1 {\n            return Err(Error::new(\n                ErrorKind::InvalidOperation,\n                \"set_strict requires exactly 1 argument\",\n            ));\n        }\n\n        let value = &args[0];\n        match value.try_iter() {\n            Ok(iter) => {\n                let set: BTreeSet<_> = iter.map(|v| v.to_string()).collect();\n                Ok(Value::from_iter(set))\n            }\n            Err(_) => Err(Error::new(\n                ErrorKind::InvalidOperation,\n                \"set_strict requires an iterable value\",\n            )),\n        }\n    }\n}","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-jinja-utils/src/functions/base.rs#L749-L785","documentation":"set_strict() is a strict variant of set() that deduplicates an iterable, failing hard rather than coercing. It accepts exactly one positional argument; any other count throws this InvalidOperation error before the value is examined.","triggerScenarios":"Calling set_strict() with zero arguments, or set_strict(a, b) with two or more positional arguments. Calling with kwargs only also triggers it since positional args are counted.","commonSituations":"Passing multiple lists expecting them to be merged — set_strict takes one iterable only; porting calls from set() where two args were tolerated into set_strict() where they are not.","solutions":["Pass exactly one iterable: set_strict(my_list)","To combine lists, concatenate first: set_strict(list_a + list_b)","Remove extra positional arguments"],"exampleFix":"// before\n{% set s = set_strict(list_a, list_b) %}\n// after\n{% set s = set_strict(list_a + list_b) %}","handlingStrategy":"validation","validationCode":"{% if lists is not sequence %}\n  {{ exceptions.raise_compiler_error('set_strict() needs one iterable in ' ~ this) }}\n{% endif %}\n{% set s = set_strict(lists) %}","typeGuard":"{% macro one_iterable(args) %}{{ return(args | length == 1 and args[0] is sequence) }}{% endmacro %}","tryCatchPattern":null,"preventionTips":["set_strict takes exactly one argument — merge lists with + first","Migrate calls from set() carefully; two-arg set() calls are invalid here","Wrap multi-list merges in a helper macro"],"tags":["jinja","dbt","argument-count"],"backgroundTag":"missing-required-argument","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"}