{"record":{"id":"f8c994c7f2fa7b31","repo":"dbt-labs/dbt-core","slug":"version-must-be-a-string-integer-or-float","errorCode":null,"errorMessage":"version must be a string, integer, or float","messagePattern":"version must be a string, integer, or float","errorType":"validation","errorClass":"minijinja::Error","httpStatus":null,"severity":"error","filePath":"crates/dbt-schemas/src/schemas/serde.rs","lineNumber":778,"sourceCode":"                    .expect(\"kind is String but as_str returned None\")\n                    .to_owned(),\n            )),\n            ValueKind::Number => {\n                if value.is_integer() {\n                    if let Some(i) = value.as_i64() {\n                        return Ok(NodeVersion::Integer(i));\n                    }\n                }\n                if let Ok(f) = f64::try_from(value) {\n                    Ok(NodeVersion::Float(f))\n                } else {\n                    Err(minijinja::Error::new(\n                        minijinja::ErrorKind::InvalidOperation,\n                        \"unsupported numeric type for version\",\n                    ))\n                }\n            }\n            _ => Err(minijinja::Error::new(\n                minijinja::ErrorKind::InvalidOperation,\n                \"version must be a string, integer, or float\",\n            )),\n        }\n    }\n}\n\n#[derive(Debug, Serialize, UntaggedEnumDeserialize, Clone, PartialEq, Eq, DbtSchema)]\n#[serde(untagged)]\npub enum StringOrMap {\n    StringValue(String),\n    MapValue(HashMap<String, YmlValue>),\n}\n\n#[derive(Serialize, UntaggedEnumDeserialize, Debug, Clone, DbtSchema)]\n#[serde(untagged)]\npub enum StringOrArrayOfStrings {\n    String(String),","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-schemas/src/schemas/serde.rs#L760-L796","documentation":"The final fallback arm of NodeVersion's TryFrom<Value> in crates/dbt-schemas/src/schemas/serde.rs. NodeVersion only supports string, integer, and float representations; any other minijinja Value kind (bool, array, dict, undefined, none) passed to the conversion produces this 'version must be a string, integer, or float' error.","triggerScenarios":"Assigning a non-scalar value to a `version` field — e.g. `version: [1, 2]`, a dictionary, a boolean, or an undefined/none template result — then converting the Value into NodeVersion via try_from.","commonSituations":"YAML config where `version:` is left empty (none) or is a list; template logic returning undefined instead of a version string; accidentally nesting version under the wrong key so a collection is passed.","solutions":["Set version to a scalar: a quoted/unquoted string, integer, or float, e.g. `version: '2.0'` or `version: 2`","Check for empty (`version:` with no value) or list-valued version entries in your YAML","Fix template expressions so they return a defined string/number instead of undefined or a dict","Validate your dbt config schema before running to catch non-scalar version values early"],"exampleFix":"# before\nversion:\n  - 1\n  - 0\n# after\nversion: '1.0'","handlingStrategy":"type-guard","validationCode":"def is_scalar_version(v):\n    if isinstance(v, bool) or v is None:\n        return False\n    return isinstance(v, (str, int, float)) or v is not None and isinstance(v, str)\n# simpler: accept only str/int/float, reject bool/None/list/dict\n\ndef is_valid_version(v):\n    if isinstance(v, bool) or v is None or isinstance(v, (list, dict)):\n        return False\n    return isinstance(v, (str, int, float))","typeGuard":"def is_valid_node_version(v):\n    return (\n        isinstance(v, str)\n        or (isinstance(v, (int, float)) and not isinstance(v, bool))\n    )","tryCatchPattern":"try:\n    node_version = NodeVersion.try_from(value)\nexcept Exception:\n    raise ValueError(\n        f\"version must be a string, integer, or float; got {type(value).__name__}: {value!r}\"\n    )","preventionTips":["Ensure `version:` in YAML is never empty, a list, a dict, or a boolean","Make template logic return a defined scalar for version","Add schema validation on dbt YAML configs before execution","Quote multi-part versions like '1.2.3' since they are strings, not numbers"],"tags":["minijinja","serialization","version","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}