dbt-labs/dbt-core · error

Version '{:?}' does not meet the required format

Error message

Version '{:?}' does not meet the required format

What it means

When collecting version info for models defined in a properties YAML file, dbt accepts a `version` field only as a YAML string or number. Any other YAML type (boolean, sequence, mapping, null, date) makes this code panic with the raw value, because no valid version string can be derived from it.

Source

Thrown at crates/dbt-parser/src/resolve/resolve_properties.rs:801

        }
    }
}

// Collect and build a properites config for all versions of a model
pub fn collect_model_version_info(
    model: &MinimalSchemaValue,
) -> Vec<(String, Option<VersionInfo>)> {
    if let Some(versions) = &model.versions {
        let mut version_entries = versions
            .iter()
            .map(|v| {
                let version = match &v.v {
                    dbt_yaml::Value::String(s, _) => Some(s.to_string()),
                    dbt_yaml::Value::Number(n, _) => Some(n.to_string()),
                    _ => None,
                }
                .unwrap_or_else(|| {
                    panic!("Version '{:?}' does not meet the required format", v.v);
                });

                let versioned_name = format!("{}_v{}", model.name, version);

                let defined_in = v
                    .defined_in
                    .as_deref()
                    .map(|s| s.strip_suffix(".sql").unwrap_or(s).to_string());

                let version_config = v.config.clone();

                (
                    version,
                    defined_in.unwrap_or(versioned_name),
                    version_config,
                )
            })
            .collect::<Vec<_>>();

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Quote the version as a string: `version: '1'` or use a plain number: `version: 1`.
  2. Remove or fix `version: null` / empty version entries in the properties file.
  3. Check for YAML type coercion: `yes/no/on/off/true/false` become booleans — quote them or use numbers.
  4. Validate the properties YAML against dbt's expected schema before running parse.

Example fix

# before (models/properties.yml)
models:
  - name: my_model
    version: true

# after
models:
  - name: my_model
    version: 1
Defensive patterns

Strategy: validation

Validate before calling

import yaml
props = yaml.safe_load(open('models/properties.yml'))
for m in props.get('models', []):
    v = m.get('version')
    assert v is None or isinstance(v, (str, int, float)), f'model {m["name"]}: bad version {v!r} (must be string or number)'

Prevention

When it happens

Trigger: Declaring `version:` in a model's properties YAML with a non-string/non-number value, e.g. `version: true`, `version: null`, `version: [1]`, `version: {latest: 1}`, or a YAML value parsed as a boolean/date (like `version: yes` or an unquoted value that YAML coerces).

Common situations: Writing `version: latest` intending the literal word without quotes (parses as string, fine) versus `version: yes` (parses as boolean true); leaving the version key empty; copy-pasting a nested version config from dbt Cloud docs into an unsupported property file shape.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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