dbt-labs/dbt-core · error · minijinja::Error (InvalidOperation)

FailFast Error for from

Error message

FailFast Error for {} from {}: {}

What it means

Raised when a Jinja macro calls `exceptions.raise_fail_fast_error(msg=...)`. This is a deliberate, user-authored abort: the macro author wants dbt to stop the run immediately (fail-fast) with the provided message. The library wraps it with the node id and file path from the Jinja state so the source of the abort is identified.

Solutions

  1. Read the `msg` in the error — it is the macro author's diagnostic; fix the underlying condition it detected.
  2. Locate the macro raising the error using the node id/file path in the message and adjust its guard logic.
  3. If the check should warn rather than halt, change the macro to use `exceptions.warn` or `log` instead.

Example fix

-- before (macro)
{% do exceptions.raise_fail_fast_error('row count is 0') %}

-- after: guard first
{% if row_count == 0 %}
  {% do exceptions.raise_fail_fast_error('row count is 0') %}
{% endif %}
Defensive patterns

Strategy: try-catch

Try / catch

// Wrap the run and surface the fail-fast message to the orchestrator
match dbt_build(&["--select", "my_model"]) {
    Err(e) if e.message.starts_with("FailFast Error") => {
        // intentional abort: alert with msg, do not retry
        alert(&e.message);
    }
    Err(e) => return Err(e),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Explicit invocation of `exceptions.raise_fail_fast_error(msg=...)` in project or package Jinja code while node metadata is present, e.g. a data-quality guard macro deciding the run should stop.

Common situations: Custom macros validating preconditions (row counts, freshness, config sanity) that intentionally halt the run; vendored package macros enforcing invariants that fire unexpectedly on the user's data.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/4032931e15344a8f. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-jinja-utils/src/functions/base.rs:1279

                            "Contract Error for {} from {}: {}",
                            node_id,
                            file_path.display(),
                            message
                        ),
                    ))
                } else {
                    Err(Error::new(
                        ErrorKind::InvalidOperation,
                        format!("Contract Error: {message}"),
                    ))
                }
            }
            // (msg, node=None)
            "raise_fail_fast_error" => {
                let mut args = ArgParser::new(args, None);
                let message = args.get::<String>("msg")?;
                if let Some((node_id, file_path)) = node_metadata_from_state(state) {
                    Err(Error::new(
                        ErrorKind::InvalidOperation,
                        format!(
                            "FailFast Error for {} from {}: {}",
                            node_id,
                            file_path.display(),
                            message
                        ),
                    ))
                } else {
                    Err(Error::new(
                        ErrorKind::InvalidOperation,
                        format!("FailFast Error: {message}"),
                    ))
                }
            }
            // (snapshot_time_data_type: str, updated_at_data_type: str)
            "warn_snapshot_timestamp_data_types" => {
                let mut args = ArgParser::new(args, None);

View on GitHub (pinned to 0267ce9170)