dbt-labs/dbt-core · error

get_seed_file_path: Failed to deserialize DbtSeed: {e}

Error message

get_seed_file_path: Failed to deserialize DbtSeed: {e}

What it means

The `adapter.get_seed_file_path(model)` Jinja method deserializes the passed model dict into a typed `DbtSeed` struct via `minijinja_value_to_typed_struct`. When the model dict does not match the expected DbtSeed schema (missing or wrongly-typed attributes such as `root_path` or `original_file_path`), the serde deserialization fails and this `SerdeDeserializeError` is raised from crates/dbt-adapter/src/adapter/mod.rs:4231.

Source

Thrown at crates/dbt-adapter/src/adapter/mod.rs:4231

            "generate_unique_temporary_table_suffix" => {
                self.generate_unique_temporary_table_suffix(state, args)
            }
            // existing_columns: List[Column], model_columns: dict, model_constraints: List[dict]
            "parse_columns_and_constraints" => self.parse_columns_and_constraints(state, args),
            // sql: str
            "clean_sql" => self.clean_sql(state, args),
            "get_seed_file_path" => {
                // model: dict (seed node)
                let iter = ArgsIter::new(name, &["model"], args);
                let model = iter.next_arg::<Value>()?;
                iter.finish()?;

                // Extract seed file path from the model
                // The seed file path is root_path + original_file_path
                let seed =
                    minijinja_value_to_typed_struct::<dbt_schemas::schemas::nodes::DbtSeed>(model)
                        .map_err(|e| {
                            minijinja::Error::new(
                                minijinja::ErrorKind::SerdeDeserializeError,
                                format!("get_seed_file_path: Failed to deserialize DbtSeed: {e}"),
                            )
                        })?;

                let root_path = seed.__seed_attr__.root_path.unwrap_or_default();
                let original_file_path = &seed.__common_attr__.original_file_path;
                let full_path = root_path.join(original_file_path);
                Ok(Value::from(full_path.display().to_string()))
            }
            "external_root" => {
                // (no args)
                let iter = ArgsIter::new(name, &[], args);
                iter.finish()?;
                self.external_root(state)
            }
            "external_write_options" => self.external_write_options(state, args),
            "external_read_location" => self.external_read_location(state, args),

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Ensure the argument passed to `adapter.get_seed_file_path()` is the actual seed node dict (e.g. `this` or the seed model object), not a relation or config object.
  2. Check the error's inner message `{e}` to see which field failed to deserialize; add that field (typically `original_file_path`, or `root_path`) to the dict with the correct type.
  3. If constructing a dict by hand, build it from the real parsed node rather than a partial map.
  4. If this comes from a custom/adapter macro, verify the adapter and dbt schema versions match — DbtSeed attributes may have changed between releases.

Example fix

// before (Jinja)
{% set path = adapter.get_seed_file_path(config.model) %}
// after (pass the seed node itself)
{% set path = adapter.get_seed_file_path(model) %}
Defensive patterns

Strategy: validation

Validate before calling

{# Jinja: ensure the object looks like a seed node before dispatching #}
{% if model is not mapping or 'original_file_path' not in model %}
  {{ exceptions.raise_compiler_error("get_seed_file_path expects a seed node dict, got: " ~ model) }}
{% endif %}
{% set path = adapter.get_seed_file_path(model) %}

Type guard

fn is_seed_node(v: &minijinja::Value) -> bool {
    v.is_object() || (v.is_mapping() && v.get_attr("original_file_path").is_defined())
}

Try / catch

{# Jinja #}
{% set path = adapter.get_seed_file_path(model) %}

Prevention

When it happens

Trigger: Calling `adapter.get_seed_file_path(...)` from a Jinja macro with a Value that is not a well-formed seed node dict — e.g. passing a model (not a seed) node, a relation object, a hand-built dict missing `original_file_path`/`root_path`, or attributes of the wrong type (string where a path/list is expected).

Common situations: Custom materialization or seed macros that pass the wrong node to get_seed_file_path; cross-project macros written for a different dbt version where the node schema differs; manually constructed node dicts in tests; dispatch to a seed macro with a `model` context instead of `seed` context.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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