dbt-labs/dbt-core · error

DbtQuoting should be set

Error message

DbtQuoting should be set

What it means

When building `NodeBaseAttributes` for generic tests, the code merges node-level quoting with the default `dbt_quoting` and converts via `.try_into().expect("DbtQuoting should be set")`. The conversion is guaranteed for a fully-populated `DbtQuoting`; the panic indicates the merged quoting value failed conversion into the target representation, i.e. an incomplete or invalid quoting structure reached the builder.

Source

Thrown at crates/dbt-schemas/src/schemas/manifest/manifest.rs:1280

                            schema: test.__common_attr__.schema,
                            alias: test.__base_attr__.alias,
                            relation_name: test.__base_attr__.relation_name,
                            materialized: DataTestConfig::default_materialized(),
                            static_analysis: Default::default(),
                            static_analysis_off_reason: None,
                            compute: test.config.compute,
                            enabled: test.config.get_enabled_with_default(),
                            extended_model: false,
                            quoting: test
                                .config
                                .quoting
                                .map(|mut quoting| {
                                    quoting.default_to(&dbt_quoting);
                                    quoting
                                })
                                .unwrap_or(dbt_quoting)
                                .try_into()
                                .expect("DbtQuoting should be set"),
                            quoting_ignore_case: false,
                            persist_docs: None,
                            columns: test.__base_attr__.columns,
                            depends_on: test.__base_attr__.depends_on,
                            refs: test.__base_attr__.refs,
                            sources: test.__base_attr__.sources,
                            functions: test.__base_attr__.functions,
                            metrics: test.__base_attr__.metrics,
                            unrendered_config: canonicalize_unrendered_config(
                                test.__base_attr__.unrendered_config,
                            ),
                        },
                        __test_attr__: DbtTestAttr {
                            column_name: test.column_name,
                            attached_node: test.attached_node,
                            test_metadata: test.test_metadata,
                            file_key_name: test.file_key_name,
                            introspection: IntrospectionKind::None,

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Ensure the project's `quoting:` config is a complete, valid block (all boolean fields) so `try_into` succeeds
  2. Regenerate cached/partial-parse artifacts with the current dbt version so quoting structures deserialize fully
  3. Replace the expect with error propagation to surface which quoting field failed conversion

Example fix

// before
.try_into().expect("DbtQuoting should be set"),
// after
.try_into().unwrap_or_default(),
Defensive patterns

Strategy: fallback

Validate before calling

// verify quoting config is complete before manifest building
if let Some(q) = &project.config.quoting {
    ensure all quoting fields (database/schema/etc.) are present and boolean;
}

Try / catch

let quoting: DbtQuoting = std::panic::catch_unwind(|| merged.try_into()).ok()
    .and_then(|r| r.ok())
    .unwrap_or_else(|| dbt_quoting.clone());

Prevention

When it happens

Trigger: Constructing test `NodeBaseAttributes` where the merged quoting value (node quoting with `default_to(&dbt_quoting)` applied, or `dbt_quoting` itself) fails `try_into` — e.g. a partially-initialized quoting struct, a quoting value built from config with unconvertible fields, or `dbt_quoting` produced by a lossy deserialization.

Common situations: Custom/older configs carrying a `quoting` block shape the converter doesn't accept; artifacts deserialized across versions where quoting fields are absent; programmatic manifest construction supplying a default-empty quoting value.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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