dbt-labs/dbt-core · error
Invalid relation type
Error message
Invalid relation type: {s} What it means
Catch-all arm of From<&str> for RelationType: the string being converted is not one of the recognized relation-type literals ('table', 'view', 'cte', 'materialized_view', 'ephemeral', 'external', 'pointer_table', 'dynamic_table', 'streaming_table', 'metric_view'), so relation-type data coming from manifest JSON or user YAML cannot be mapped onto the enum.
Solutions
- Correct the relation type string in the source YAML/manifest to one of the supported literals
- Add the new literal as a match arm (plus a RelationType variant) if a genuinely new relation kind was introduced
- Normalize the input (trim, lowercase) before calling RelationType::from
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/dbt-schemas/src/dbt_types.rs:119 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/509541ff8af21965.
Report an issue: GitHub.
Appendix: source
Thrown at crates/dbt-schemas/src/dbt_types.rs:119
}
impl From<&str> for RelationType {
fn from(s: &str) -> Self {
match s {
"table" => RelationType::Table,
"view" => RelationType::View,
"cte" => RelationType::CTE,
"materialized_view" => RelationType::MaterializedView,
"ephemeral" => RelationType::Ephemeral,
"external" => RelationType::External,
"pointer_table" => RelationType::PointerTable,
"dynamic_table" => RelationType::DynamicTable,
"streaming_table" => RelationType::StreamingTable,
"metric_view" => RelationType::MetricView,
"function" => RelationType::Function,
"interactive_table" => RelationType::InteractiveTable,
"dictionary" => RelationType::Dictionary,
_ => panic!("Invalid relation type: {s}"),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::collections::HashMap;
#[test]
fn dictionary_relation_type_round_trips() {
let rt = RelationType::from("dictionary");
assert_eq!(rt, RelationType::Dictionary);
assert_eq!(rt.to_string(), "dictionary");
}
#[test]
fn spark_real_types_resolve_to_table_or_view() {View on GitHub (pinned to 0267ce9170)