dbt-labs/dbt-core · error
ReplayStatement::prepare
Error message
ReplayStatement::prepare
What it means
ReplayStatement::prepare is unimplemented in the adbc-record-replay crate. The todo!() placeholder panics when a caller prepares a SQL query on a replay statement. Note set_sql_query does work (it stores the SQL), so the panic only occurs at the prepare step of the prepared-statement lifecycle.
Source
Thrown at crates/adbc-record-replay/src/replay.rs:344
}
StorageType::FileArrowIpc | StorageType::FileParquet => Ok(None),
}
}
fn execute_schema(&mut self) -> AdbcResult<Schema> {
todo!("ReplayStatement::execute_schema")
}
fn execute_partitions(&mut self) -> AdbcResult<adbc_core::PartitionedResult> {
todo!("ReplayStatement::execute_partitions")
}
fn get_parameter_schema(&self) -> AdbcResult<Schema> {
todo!("ReplayStatement::get_parameter_schema")
}
fn prepare(&mut self) -> AdbcResult<()> {
todo!("ReplayStatement::prepare")
}
fn set_sql_query(&mut self, sql: &str) -> AdbcResult<()> {
self.sql = Some(sql.to_string());
Ok(())
}
fn set_substrait_plan(&mut self, _plan: &[u8]) -> AdbcResult<()> {
unimplemented!("ReplayStatement::set_substrait_plan")
}
fn cancel(&mut self) -> AdbcResult<()> {
todo!("ReplayStatement::cancel")
}
fn set_option(&mut self, key: OptionStatement, value: OptionValue) -> AdbcResult<()> {
if let OptionStatement::Other(ref name) = key {
self.ctx.absorb_option(name, &value);View on GitHub (pinned to 0267ce9170)
Solutions
- Use the unprepared path (set_sql_query + execute) during replay instead of prepare
- Implement prepare to replay the recorded prepared-statement state
- Return a proper Status::NotImplemented error instead of panicking
- Record and replay only workloads that avoid prepared statements
Example fix
// before
fn prepare(&mut self) -> AdbcResult<()> {
todo!("ReplayStatement::prepare")
}
// after
fn prepare(&mut self) -> AdbcResult<()> {
Err(adbc_core::error::Error::with_message(
Status::NotImplemented,
"prepare is not supported by the replay driver".into(),
))
} Defensive patterns
Strategy: fallback
Validate before calling
fn replay_supports_prepare(stmt: &ReplayStatement) -> bool {
false // prepare is not implemented in the replay driver
} Try / catch
if replay_supports_prepare(&stmt) {
stmt.prepare()?;
stmt.execute()?;
} else {
stmt.set_sql_query(&sql)?;
stmt.execute()?; // fallback: unprepared execution
} Prevention
- Use set_sql_query + execute instead of prepare during replay
- Record only unprepared workloads for replay
- Contribute prepare support to the replay driver before replaying prepared flows
When it happens
Trigger: Calling Statement::prepare on a record-replay driver statement after setting a SQL query.
Common situations: Prepared-statement based clients replaying recorded sessions; ORMs or query builders that always call prepare before execute; replaying parameterized workloads.
Related errors
- ReplayStatement::bind
- ReplayStatement::bind_stream
- ReplayStatement::execute_schema
- ReplayStatement::execute_partitions
- ReplayStatement::get_parameter_schema
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/e1d107cc3de22824.
Report an issue: GitHub.