{"record":{"id":"0d71da9ef5bec7be","repo":"dbt-labs/dbt-core","slug":"get-csv-data-requires-agate-table-argument","errorCode":null,"errorMessage":"get_csv_data requires agate_table argument","messagePattern":"get_csv_data requires agate_table argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/mod.rs","lineNumber":4364,"sourceCode":"                }\n            }\n            \"check_incremental_schema_changes\" => {\n                // on_schema_change: str, existing: Relation, target_sql: str, materialization: str = 'incremental', query_settings: dict = None -> ClickHouseColumnChanges | none\n                self.check_incremental_schema_changes(state, args)\n            }\n            \"filter_settings_by_engine\" => {\n                // model: dict, settings: str -> str\n                Ok(args.get(1).cloned().unwrap_or_else(|| Value::from(\"\")))\n            }\n            \"get_ch_database\" => {\n                // schema: str -> str (CH database = schema in 2-part naming)\n                Ok(args.first().cloned().unwrap_or_else(|| Value::from(\"\")))\n            }\n            \"get_csv_data\" => {\n                let table = args\n                    .first()\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::MissingArgument,\n                            \"get_csv_data requires agate_table argument\",\n                        )\n                    })?\n                    .downcast_object::<AgateTable>()\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"get_csv_data: argument must be an AgateTable\",\n                        )\n                    })?;\n                self.get_csv_data(table)\n            }\n            \"get_credentials\" => self.get_credentials(args),\n            \"render_equals\" => {\n                let iter = ArgsIter::new(name, &[\"expr1\", \"expr2\"], args);\n                let expr1 = iter.next_arg::<&str>()?;\n                let expr2 = iter.next_arg::<&str>()?;","sourceCodeStart":4346,"sourceCodeEnd":4382,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/mod.rs#L4346-L4382","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (Jinja)\n{% set csv = adapter.get_csv_data() %}\n// after\n{% set csv = adapter.get_csv_data(agate_table) %}","handlingStrategy":"validation","validationCode":"{# Jinja: check the argument exists before calling #}\n{% if agate_table is not defined %}\n  {{ exceptions.raise_compiler_error(\"agate_table is required for adapter.get_csv_data\") }}\n{% endif %}\n{% set csv = adapter.get_csv_data(agate_table) %}","typeGuard":"{# Jinja #}\n{% set ok = agate_table is defined and agate_table is not string and agate_table is not mapping %}","tryCatchPattern":null,"preventionTips":["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."],"tags":["jinja","missing-argument","csv"],"backgroundTag":"missing-required-argument","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"}