dbt-labs/dbt-core · error

DbtQuoting should be set

Error message

DbtQuoting should be set

What it means

A panic from `.expect()` in `NodeBaseAttributes` construction while building model/seed/snapshot nodes: `model_config.quoting.try_into()` must convert the config's quoting value into `DbtQuoting`, and the code asserts the conversion always succeeds. The expect fires when the quoting map in the model config contains values that cannot be represented as `DbtQuoting`.

Source

Thrown at crates/dbt-parser/src/resolve/resolve_functions.rs:412

                meta: model_config.meta.clone().unwrap_or_default(),
            },
            __base_attr__: NodeBaseAttributes {
                adapter: selected_adapter,
                // A function is not a relation, so there is nothing to bind into another
                // platform's catalog: no `+propagate` config exists for this node type.
                propagate: Vec::new(),
                database: database.to_string(), // will be updated below
                schema: schema.to_string(),     // will be updated below
                alias: "".to_owned(),           // will be updated below
                relation_name: None,            // will be updated below
                materialized: DbtMaterialization::Function,
                static_analysis,
                static_analysis_off_reason: None,
                compute: None,
                quoting: model_config
                    .quoting
                    .try_into()
                    .expect("DbtQuoting should be set"),
                quoting_ignore_case: false,
                enabled: model_config.enabled,
                extended_model: false,
                persist_docs: None,
                columns: vec![],
                depends_on,
                refs: sql_file_info
                    .refs
                    .iter()
                    .map(|(model, project, version, location)| DbtRef {
                        name: model.to_owned(),
                        package: project.to_owned(),
                        version: version.clone(),
                        location: Some(location.with_file(&dbt_asset.path)),
                    })
                    .collect(),
                functions: sql_file_info
                    .functions

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Fix the `quoting:` block so it only contains valid keys (database/schema/identifier etc.) with boolean values
  2. Check for quoting config inherited from dbt_project.yml that merges into the model config
  3. Align quoting keys with the dbt version this crate tracks (renamed keys break the conversion)
  4. Replace the expect with a proper error to surface the offending key instead of panicking

Example fix

# before
models:
  my_model:
    +quoting:
      databse: true   # typo, not a valid DbtQuoting key

# after
models:
  my_model:
    +quoting:
      database: true
      schema: true
      identifier: false
Defensive patterns

Strategy: validation

Validate before calling

fn validate_quoting(quoting: &IndexMap<String, BoolOrAttemptedVal>) -> Result<(), String> {
    const VALID: &[&str] = &["database", "schema", "identifier"];
    for k in quoting.keys() {
        if !VALID.contains(&k.as_str()) {
            return Err(format!("invalid quoting key `{k}`, expected one of {VALID:?}"));
        }
    }
    Ok(())
}

Type guard

fn is_valid_quoting_key(k: &str) -> bool {
    matches!(k, "database" | "schema" | "identifier")
}

Prevention

When it happens

Trigger: A model (or project-level model config) defines a `quoting:` block with keys or value types that fail `TryInto<DbtQuoting>` during node resolution (`resolve_functions.rs`), e.g. an unexpected key or a non-boolean value.

Common situations: Typo'd or misspelled quoting keys in `quoting:` config (e.g. under models: in dbt_project.yml or a model's config block); copying quoting config from documentation for a different dbt version; YAML quoting values given as strings instead of booleans.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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