dbt-labs/dbt-core · error

Failed to convert quoting to resolved quoting

Error message

Failed to convert quoting to resolved quoting

What it means

In the `this` function resolver for parse-time model contexts, the package-level quoting config is converted into a resolved `Quoting` via `try_into()` and unwrapped with `expect`. The panic fires when the stored quoting value cannot be represented as a fully resolved quoting (e.g. it is null/undefined where a concrete bool is required). It means the relation cannot be rendered because quoting policy is not resolvable.

Source

Thrown at crates/dbt-jinja-utils/src/phases/parse/resolve_model_context.rs:91

    sql_resources: Arc<Mutex<Vec<SqlResource<T>>>>,
    execute_exists: Arc<AtomicBool>,
    display_path: &Path,
    model_path: &Path,
    global_static_analysis: Option<StaticAnalysisKind>,
) -> BTreeMap<String, MinijinjaValue> {
    // Create a relation for 'this' using config values
    let sql_resources_clone = sql_resources.clone();
    let this_relation = ResolveThisFunction {
        relation: dbt_adapter::relation::RelationObject::new(Arc::from(
            dbt_adapter::relation::do_create_relation(
                adapter_type,
                database.to_string(),
                schema.to_string(),
                Some(model_name.to_string()),
                None,
                package_quoting
                    .try_into()
                    .expect("Failed to convert quoting to resolved quoting"),
            )
            .unwrap(),
        ))
        .into_value(),
        sql_resources: sql_resources_clone,
    };
    let this_value = MinijinjaValue::from_object(this_relation);

    // Create a BTreeMap for builtins
    let mut builtins = BTreeMap::new();

    // Create ref function
    let sql_resources_clone = sql_resources.clone();
    let ref_function = ResolveRefFunction {
        database: database.to_string(),
        schema: schema.to_string(),
        adapter_type,
        sql_resources: sql_resources_clone,

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Replace null quoting values in dbt_project.yml `quoting:` with explicit true/false (or remove the keys to use defaults)
  2. Check your profile/target that quoting is fully resolved before parse (run `dbt debug` to inspect the resolved target)
  3. At the code level, merge defaults so `package_quoting` is always a resolved Quoting before calling `.try_into()`
  4. Report/patch: turn the expect into a proper error reporting which quoting field was unresolved

Example fix

// before (dbt_project.yml)
quoting:
  database: null
  schema: null
  identifier: true
// after
quoting:
  database: true
  schema: true
  identifier: true
Defensive patterns

Strategy: validation

Validate before calling

# dbt_project.yml quoting must be fully concrete before parse
# quick check:
grep -n "null" dbt_project.yml  # ensure no quoting: <key>: null
# or in Rust:
let resolved: Option<Quoting> = package_quoting.clone().try_into().ok();
assert!(resolved.is_some(), "quoting not resolved");

Type guard

fn quoting_is_resolved(q: &serde_yaml::Value) -> bool {
    ["database", "schema", "identifier"].iter().all(|k| {
        q.get(k).map_or(true, |v| v.is_bool())
    })
}

Try / catch

package_quoting.clone().try_into().map_err(|e|
    anyhow!("quoting not resolvable for {{ this }}: {e}"))?

Prevention

When it happens

Trigger: Resolving `{{ this }}` in a model whose target or package quoting config contains unresolved/None fields (e.g. `quoting: {database: null, schema: null}` in dbt_project.yml, or a target without quoting defaults applied).

Common situations: dbt_project.yml quoting keys set to null instead of true/false; custom targets lacking quoting resolution; adapter profiles where quoting defaults were never merged before parse.

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/fc2eeeaf8f3fc55b. Report an issue: GitHub.