dbt-labs/dbt-core · error

Unsupported relation type

Error message

Unsupported relation type ({}) in {}:{}

What it means

The unwrapped RelationObject holds an inner relation of a concrete type this operation does not accept — the downcast to the expected relation implementation failed, and the message names both the offending relation type and the file/line of the call site that rejected it.

Solutions

  1. Use one of the supported relation implementations for this operation
  2. Extend the downcast target (or add a trait method) to accept the named relation type
  3. Validate the relation kind at the adapter entry point before dispatching
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/dbt-adapter/src/cast_util.rs:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/dbt-adapter/src/cast_util.rs:36

        .ok_or_else(|| {
            minijinja::Error::new(
                minijinja::ErrorKind::InvalidOperation,
                "relation must be an object",
            )
        })?
        .get_value(&minijinja::Value::from(THIS_RELATION_KEY))
    {
        Ok(relation_object
            .downcast_object::<RelationObject>()
            .ok_or_else(|| {
                minijinja::Error::new(
                    minijinja::ErrorKind::InvalidOperation,
                    "this must be a BaseRelation object",
                )
            })?
            .inner())
    } else {
        Err(minijinja::Error::new(
            minijinja::ErrorKind::InvalidOperation,
            format!(
                "Unsupported relation type ({}) in {}:{}",
                value,
                file!(),
                line!()
            ),
        ))
    }
}

View on GitHub (pinned to 0267ce9170)