{"record":{"id":"577d3c85b99db931","repo":"dbt-labs/dbt-core","slug":"warn-string","errorCode":null,"errorMessage":"{warn_string}","messagePattern":"\\{warn_string\\}","errorType":"exception","errorClass":"ExitWithStatus","httpStatus":null,"severity":"error","filePath":"crates/dbt-jinja-utils/src/functions/base.rs","lineNumber":1125,"sourceCode":"                    FsError::new_no_backtrace(ErrorCode::JinjaWarn, warn_string.clone())\n                        .with_location(CodeLocationWithFile::new(\n                            current_span.start_line,\n                            current_span.start_col,\n                            current_span.start_offset,\n                            current_file_path,\n                        )),\n                );\n\n                // Emit through the warn path even when warn-error upgrades it because tracing\n                // handles the event level upgrade for dbt-facing outputs.\n                let warn_error_decision = self\n                    .warn_error_options\n                    .decision_for_error_code(warning.code)\n                    == WarnErrorDecision::UpgradeToError;\n                emit_warn_log_from_fs_error(*warning);\n\n                if warn_error_decision {\n                    return Err(Error::new(ErrorKind::ExitWithStatus, warn_string));\n                }\n\n                Ok(Value::UNDEFINED)\n            }\n            // (msg, node=None)\n            \"raise_compiler_error\" => {\n                let mut args = ArgParser::new(args, None);\n                let message = args.get::<String>(\"msg\")?;\n                if let Some((node_id, file_path)) = node_metadata_from_state(state) {\n                    Err(Error::new(\n                        ErrorKind::InvalidOperation,\n                        format!(\n                            \"Compilation Error for {} from {}: {}\",\n                            node_id,\n                            file_path.display(),\n                            message\n                        ),\n                    ))","sourceCodeStart":1107,"sourceCodeEnd":1143,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-jinja-utils/src/functions/base.rs#L1107-L1143","documentation":"When a Jinja template calls dbt's `warn(msg)` and the project's warn-error options promote that warning code to an error (`WarnErrorDecision::UpgradeToError`), the library converts the warning into an `ExitWithStatus` error carrying the warning text. This is intentional behavior: `--warn-error` style configuration turns warnings into hard failures.","triggerScenarios":"A template calls `warn(...)` (or `exceptions.warn`) while `warn_error_options.decision_for_error_code` maps the warning's code to `UpgradeToError`.","commonSituations":"Running with `--warn-error` or `--warn-error-options` include/exclude settings that include the raised warning code, causing an otherwise benign warning to abort the run.","solutions":["Remove the warning's code from the warn-error include list (or add it to exclude) in warn_error_options","Fix the underlying condition the warn() call reports so it is never triggered","Drop the `--warn-error` flag if promotion to error is not desired"],"exampleFix":"// before (dbt_project.yml / CLI)\nflags: warn_error: true\n// after\nflags:\n  warn_error_options:\n    include: [other-warning-code]  # exclude the code being raised","handlingStrategy":"try-catch","validationCode":"// inspect decision before raising:\n// warn_error_options.decision_for_error_code(code) != UpgradeToError","typeGuard":null,"tryCatchPattern":"// CLI: capture non-zero exit and inspect stderr for the warn_string\nmatch run_dbt() {\n    Err(e) if e.to_string().contains(\"warn\") => warn!(\"warning promoted to error: {e}\"),\n    other => other?,\n}","preventionTips":["Review warn_error_options include/exclude lists before runs","Avoid warn() for conditions that should fail loudly; use raise_compiler_error instead","Keep warning codes stable across template refactors"],"tags":["jinja","warn-error","configuration"],"backgroundTag":"invalid-config-value","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"}