dbt-labs/dbt-core · error

not a CatalogType::as_str() output

Error message

not a CatalogType::as_str() output

What it means

Documented asymmetry in parse_from_str: 'BUILT_IN' is accepted as an input token (Snowflake built-in catalog) but is deliberately not a CatalogType::as_str() output — the round trip is one-way. Code that echoes parsed values back through as_str() will not reproduce this raw string.

Solutions

  1. Do not round-trip 'BUILT_IN' through as_str(); retain the original raw string
  2. Normalize tokens so parse(as_str(x)) == x holds for every variant
  3. Keep the one-way token documented next to the match arm
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/dbt-schemas/src/schemas/dbt_catalogs_v2.rs:738 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/7c88e99bde5ad931. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-schemas/src/schemas/dbt_catalogs_v2.rs:738

        match raw {
            "horizon" => Self::Horizon,
            "glue" => Self::Glue,
            // "ICEBERG_REST" only exists on the Jinja plane. Model configs should
            // be lowercase to obscure the internal uppercase as much as possible.
            "iceberg_rest" => Self::IcebergRest,
            "hive_metastore" => Self::HiveMetastore,
            "unity" => Self::Unity,
            "biglake_metastore" => Self::BiglakeMetastore,
            "ducklake" => Self::DuckLake,
            "local_filesystem" => Self::LocalFilesystem,
            "BUILT_IN" => Self::SnowflakeBuiltIn,
            "duckdb" => Self::DuckdbNative,
            "INFO_SCHEMA" => match adapter_type {
                dbt_adapter_core::AdapterType::Bigquery => Self::BigqueryNative,
                dbt_adapter_core::AdapterType::Snowflake => Self::SnowflakeNative,
                _ => unreachable!("only Snowflake/Bigquery ever egress INFO_SCHEMA"),
            },
            _ => unreachable!("not a CatalogType::as_str() output"),
        }
    }
}

impl serde::Serialize for CatalogType {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        serializer.serialize_str(self.as_str())
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum TableFormat {
    Default,
    Iceberg,
}

impl TableFormat {

View on GitHub (pinned to 0267ce9170)