{"record":{"id":"c4a18c53141f6ee5","repo":"dbt-labs/dbt-core","slug":"local-md5-requires-exactly-1-argument","errorCode":null,"errorMessage":"local_md5 requires exactly 1 argument","messagePattern":"local_md5 requires exactly 1 argument","errorType":"validation","errorClass":"InvalidOperation","httpStatus":null,"severity":"error","filePath":"crates/dbt-jinja-utils/src/functions/base.rs","lineNumber":1035,"sourceCode":"\n        Ok(Value::from(\"\"))\n    }\n}\n\n/// Calculate an MD5 hash of the given string.\n///\n/// Args:\n///     value: String to hash\n///\n/// Example:\n/// ```jinja\n/// {% set hash = local_md5(\"hello\") %}\n/// -- Returns \"5d41402abc4b2a76b9719d911017c592\"\n/// ```\npub fn local_md5_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                \"local_md5 requires exactly 1 argument\",\n            ));\n        }\n\n        let value = args[0].as_str().ok_or_else(|| {\n            Error::new(\n                ErrorKind::InvalidOperation,\n                \"local_md5's argument must be a string\",\n            )\n        })?;\n        // Create MD5 hasher\n        let result = format!(\"{:x}\", md5::compute(value.as_bytes()));\n        Ok(Value::from(result))\n    }\n}\n\n/// Parse a dictionary of lists into a BTreeMap<String, Vec<String>>","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-jinja-utils/src/functions/base.rs#L1017-L1053","documentation":"`local_md5` computes the MD5 hash of a string locally (no warehouse round-trip) and requires exactly one positional argument. Calls with zero or with two-plus arguments are rejected with this error to keep parity with dbt-core's single-argument signature.","triggerScenarios":"Calling `{{ local_md5() }}` or `{{ local_md5(a, b) }}` — any argument count other than 1.","commonSituations":"Building hash keys from multiple fields and forgetting to concatenate them first, or a macro parameter list drifting out of sync with the call site.","solutions":["Pass exactly one string argument","Concatenate multiple fields first: `local_md5(field1 ~ field2)`","Check the call site signature matches the macro/function definition"],"exampleFix":"// before\n{% set h = local_md5(col1, col2) %}\n// after\n{% set h = local_md5(col1 ~ col2) %}","handlingStrategy":"validation","validationCode":"{% if fields | length != 1 %}{{ log('local_md5 takes exactly 1 arg') }}{% endif %}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass exactly one string argument","Concatenate multiple fields before hashing","Keep macro call sites in sync with definitions"],"tags":["jinja","argument-count","md5"],"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"}