{"record":{"id":"7d13ee3fe38f83c1","repo":"dbt-labs/dbt-core","slug":"zip-strict-requires-two-or-more-iterable-arguments","errorCode":null,"errorMessage":"zip_strict requires two or more iterable arguments","messagePattern":"zip_strict requires two or more iterable arguments","errorType":"validation","errorClass":"InvalidOperation","httpStatus":null,"severity":"error","filePath":"crates/dbt-jinja-utils/src/functions/base.rs","lineNumber":887,"sourceCode":"    }\n}\n\n/// Strict version of zip() that fails if any input is not iterable or the iterables differ in length.\n///\n/// Args:\n///     *iterables: Two or more iterables\n///\n/// Example:\n/// ```jinja\n/// {% set list1 = [1, 2, 3] %}\n/// {% set list2 = ['a', 'b', 'c'] %}\n/// {% set pairs = zip_strict(list1, list2) %}\n/// -- Returns [(1, 'a'), (2, 'b'), (3, 'c')] or fails if inputs aren't iterable or lengths differ\n/// ```\npub fn zip_strict_fn() -> impl Fn(&[Value], Kwargs) -> Result<Value, Error> {\n    move |args: &[Value], _kwargs: Kwargs| -> Result<Value, Error> {\n        if args.len() < 2 {\n            return Err(Error::new(\n                ErrorKind::InvalidOperation,\n                \"zip_strict requires two or more iterable arguments\",\n            ));\n        }\n\n        let mut iterators: Vec<Vec<Value>> = Vec::new();\n        for arg in args {\n            match arg.try_iter() {\n                Ok(iter) => iterators.push(iter.collect()),\n                Err(_) => {\n                    return Err(Error::new(\n                        ErrorKind::InvalidOperation,\n                        \"zip_strict requires all arguments to be iterable\",\n                    ));\n                }\n            }\n        }\n","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-jinja-utils/src/functions/base.rs#L869-L905","documentation":"This error is thrown by the `zip_strict` Jinja helper in dbt-jinja-utils when the function is invoked with fewer than two positional arguments. `zip_strict` mirrors dbt-core's strict zip: it pairs elements from multiple iterables and fails if lengths differ. The library enforces a minimum of two iterables because zipping a single list has no meaningful pairing semantics.","triggerScenarios":"Calling `zip_strict(list1)` or `zip_strict()` in a Jinja template — i.e. passing 0 or 1 positional arguments to the registered base function.","commonSituations":"Refactoring a template that previously used a single-list helper, copying a dbt macro that assumed `zip` semantics with one list, or accidentally shadowing a variable so only one list argument is rendered.","solutions":["Pass at least two iterable arguments to zip_strict, e.g. `zip_strict(list1, list2)`","If you only need to iterate one list, use a plain `{% for %}` loop or `zip(list, range(...))` instead","Log/inspect the rendered arguments just before the call to confirm both lists are defined and non-empty"],"exampleFix":"// before\n{% set pairs = zip_strict(my_list) %}\n// after\n{% set pairs = zip_strict(my_list, other_list) %}","handlingStrategy":"validation","validationCode":"{% if lists | length < 2 %}{{ exceptions.raise_compiler_error('zip_strict needs 2+ lists') }}{% endif %}","typeGuard":"{% macro ensure_zip_args(*lists) %}{{ raise_compiler_error('need 2+') if lists | length < 2 }}{% endmacro %}","tryCatchPattern":null,"preventionTips":["Always pass two or more lists to zip_strict","Use plain zip or a for-loop when iterating a single list","Sanity-check variables with log() before zipping"],"tags":["jinja","argument-count","zip"],"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-17T15:17:12.973Z"}