{"record":{"id":"f460c934f167717b","repo":"dbt-labs/dbt-core","slug":"expected-at-least-one-argument","errorCode":null,"errorMessage":"Expected at least one argument","messagePattern":"Expected at least one argument","errorType":"exception","errorClass":"minijinja::Error (InvalidOperation)","httpStatus":null,"severity":"error","filePath":"crates/dbt-jinja-utils/src/utils.rs","lineNumber":92,"sourceCode":"pub fn as_bool(args: Value) -> Result<Value, Error> {\n    let input = args.to_string();\n    match input.parse::<i64>() {\n        Ok(int_value) => Ok(Value::from(int_value != 0)),\n        Err(_) => match input.parse::<f64>() {\n            Ok(float_value) => Ok(Value::from(!float_value.is_nan() && float_value != 0.0)),\n            Err(_) => match input.to_ascii_lowercase().as_str() {\n                \"true\" => Ok(Value::from(true)),\n                \"false\" => Ok(Value::from(false)),\n                _ => Ok(Value::from(!input.is_empty())),\n            },\n        },\n    }\n}\n\n/// Asserts a condition using Jinja\npub fn assert_minijinja(_state: &State, args: Rest<Value>) -> Result<Value, Error> {\n    if args.is_empty() {\n        return Err(Error::new(\n            ErrorKind::InvalidOperation,\n            \"Expected at least one argument\",\n        ));\n    }\n    let expr = args[0].clone();\n    let message = args.get(1).map_or_else(String::new, |v| v.to_string());\n    let condition = as_bool(expr)?;\n    if condition == Value::from(false) {\n        eprintln!(\"error: {} assertion failed\", &message);\n    }\n    Ok(Value::from(\"\"))\n}\n\n/// Logs a message using Jinja\npub fn log_minijinja(state: &State, args: Rest<Value>) -> String {\n    let debug_str = debug(state, args);\n    eprintln!(\"log: {}\", &debug_str);\n    \"\".to_owned()","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-jinja-utils/src/utils.rs#L74-L110","documentation":"`assert_minijinja` evaluates a Jinja expression as an assertion and requires at least one argument — the expression to assert. An optional second argument supplies the failure message. The library throws this `InvalidOperation` error when the function is invoked with zero arguments, since there is nothing to assert.","triggerScenarios":"Calling `{% do assert() %}` / `assert_minijinja()` with no arguments in a template or test that wires the assert function.","commonSituations":"Empty assert calls left behind while editing tests; macro-generated asserts where the expression variable was undefined and dropped from the call; copy-pasted generic test templates.","solutions":["Pass at least the expression to assert: `assert(expression)` or `{{ assert(1 == 1, 'sanity check') }}`.","Add an optional second argument as the assertion failure message.","Guard macro-generated calls so the expression is always interpolated before the assert call is emitted."],"exampleFix":"-- before\n{% do assert() %}\n-- after\n{% do assert(model.row_count > 0, 'model returned no rows') %}\n","handlingStrategy":"validation","validationCode":"{% if assertion_expr is undefined %}\n  {{ exceptions.raise_compiler_error('assert() requires an expression argument') }}\n{% else %}\n  {% do assert(assertion_expr, 'failed') %}\n{% endif %}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never emit assert() with an empty argument list from generated templates.","Always pass an explicit failure message as the second argument.","Interpolate variables before the call so undefined values surface early."],"tags":["jinja","assertions","arity"],"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"}