dbt-labs/dbt-core · error
get_csv_data requires agate_table argument
Error message
get_csv_data requires agate_table argument
What it means
`adapter.get_csv_data(agate_table)` serializes an agate table to CSV text. The dispatcher first checks that at least one positional argument was supplied; if `args` is empty it raises `MissingArgument` with this message, because the method cannot produce CSV without a table.
Source
Thrown at crates/dbt-adapter/src/adapter/mod.rs:4364
}
}
"check_incremental_schema_changes" => {
// on_schema_change: str, existing: Relation, target_sql: str, materialization: str = 'incremental', query_settings: dict = None -> ClickHouseColumnChanges | none
self.check_incremental_schema_changes(state, args)
}
"filter_settings_by_engine" => {
// model: dict, settings: str -> str
Ok(args.get(1).cloned().unwrap_or_else(|| Value::from("")))
}
"get_ch_database" => {
// schema: str -> str (CH database = schema in 2-part naming)
Ok(args.first().cloned().unwrap_or_else(|| Value::from("")))
}
"get_csv_data" => {
let table = args
.first()
.ok_or_else(|| {
minijinja::Error::new(
minijinja::ErrorKind::MissingArgument,
"get_csv_data requires agate_table argument",
)
})?
.downcast_object::<AgateTable>()
.ok_or_else(|| {
minijinja::Error::new(
minijinja::ErrorKind::InvalidOperation,
"get_csv_data: argument must be an AgateTable",
)
})?;
self.get_csv_data(table)
}
"get_credentials" => self.get_credentials(args),
"render_equals" => {
let iter = ArgsIter::new(name, &["expr1", "expr2"], args);
let expr1 = iter.next_arg::<&str>()?;
let expr2 = iter.next_arg::<&str>()?;View on GitHub (pinned to 0267ce9170)
Solutions
- Pass the agate table as the first positional argument: `adapter.get_csv_data(agate_table)`.
- In custom macros, make sure the `agate_table` parameter is declared and forwarded, not shadowed or dropped.
- Check the macro's dispatcher (`adapter.get_csv_data` calls in the adapter's included macros) to confirm the argument order matches the Rust side.
Example fix
// before (Jinja)
{% set csv = adapter.get_csv_data() %}
// after
{% set csv = adapter.get_csv_data(agate_table) %} Defensive patterns
Strategy: validation
Validate before calling
{# Jinja: check the argument exists before calling #}
{% if agate_table is not defined %}
{{ exceptions.raise_compiler_error("agate_table is required for adapter.get_csv_data") }}
{% endif %}
{% set csv = adapter.get_csv_data(agate_table) %} Type guard
{# Jinja #}
{% set ok = agate_table is defined and agate_table is not string and agate_table is not mapping %} Prevention
- Forward the `agate_table` parameter through every macro layer that ultimately calls get_csv_data.
- Declare `agate_table` in the macro signature so it cannot be silently undefined.
- Compare against dbt-core's `adapter.get_csv_data(agate)` signature when porting macros.
When it happens
Trigger: Calling `adapter.get_csv_data()` with zero arguments from a Jinja macro (e.g. `get_csv_data()` instead of `get_csv_data(table)`), or a macro dispatching the call after dropping/failing to forward its `agate_table` parameter.
Common situations: Custom seed/loading macros copied from an older dbt release where the signature differed; macro helper functions that conditionally forward arguments and end up passing none; typos so the table argument is bound to a keyword the dispatcher ignores.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- get_csv_data: argument must be an AgateTable
- get_csv_data: failed to format CSV: {e}
- diff_of_two_dicts requires a dict_a argument
- diff_of_two_dicts requires a dict_b argument
- write function requires payload argument
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/0d71da9ef5bec7be.
Report an issue: GitHub.