nautechsystems/nautilus_trader · error
Unknown execution event marker
Error message
Unknown execution event marker {event} What it means
BlockchainExecutionDatabase::mark_execution_emitted matches an execution event marker string against known variants (e.g. "fill", "terminal") to pick the SQL UPDATE statement. When called with any other marker string, the catch-all arm aborts with anyhow::bail! before any query is executed. It is a guard against typos or newly added marker kinds that the database layer has not been taught to handle.
Solutions
- Check the event string passed to mark_execution_emitted and correct the typo or casing (valid values: "fill", "terminal").
- If a new execution event marker is legitimately needed, add a match arm in crates/adapters/blockchain/src/cache/database.rs (~line 7372) with the appropriate UPDATE statement before the catch-all.
- Grep the codebase for mark_execution_emitted call sites and align the marker constants used there with the match arms.
- If versions diverge, update the blockchain adapter and the calling crate to matching versions.
Example fix
// before let marker = "filled"; db.mark_execution_emitted(intent_id, marker).await?; // after let marker = "fill"; // must be "fill" or "terminal" db.mark_execution_emitted(intent_id, marker).await?;
Defensive patterns
Strategy: validation
Validate before calling
const VALID_MARKERS: [&str; 2] = ["fill", "terminal"];
if !VALID_MARKERS.contains(&event) {
return Err(anyhow::anyhow!("Unknown execution event marker {event}; expected one of {VALID_MARKERS:?}"));
}
db.mark_execution_emitted(intent_id, event).await?; Try / catch
match db.mark_execution_emitted(intent_id, event).await {
Ok(_) => { /* proceed */ }
Err(e) if e.to_string().contains("Unknown execution event marker") => {
log::error!("event marker '{event}' not supported by db layer: {e}");
}
Err(e) => return Err(e),
} Prevention
- Define execution event markers as a Rust enum with Display, and convert to string only at the db boundary.
- Keep marker constants in one shared module used by both callers and the database layer.
- Add a unit test asserting mark_execution_emitted accepts exactly the supported markers.
When it happens
Trigger: Calling mark_execution_emitted(intent_id, event) with an event marker other than "fill" or "terminal" — e.g. a misspelled marker like "filled", a renamed marker after a refactor, or a new execution event kind added upstream in the emission logic without a matching match arm here.
Common situations: Developers adding a new execution lifecycle stage (e.g. "intent", "cancel") forget to extend the match in database.rs; callers pass user- or config-supplied event names; a version mismatch where the caller crate emits a marker this adapter version does not know.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Failed to assemble order
- Failed to commit order client origins
- Failed to index order client origin
- Failed to insert into bar table
- Failed to insert into order_position_index table
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/c95f96993393ede2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/blockchain/src/cache/database.rs:7372
///
/// Returns an error if the event kind is unknown, the intent is absent, the opposing
/// terminal marker is already set, or persistence fails.
pub async fn mark_execution_event_emitted(
&self,
intent_id: i64,
event: &str,
) -> anyhow::Result<()> {
let statement = match event {
"acknowledgement" => {
"UPDATE execution_intent SET acknowledgement_emitted = TRUE, updated_at = NOW() WHERE id = $1"
}
"fill" => {
"UPDATE execution_intent SET fill_emitted = TRUE, active = CASE WHEN status = 'finalized' THEN FALSE ELSE active END, updated_at = NOW() WHERE id = $1 AND NOT terminal_emitted"
}
"terminal" => {
"UPDATE execution_intent SET terminal_emitted = TRUE, active = CASE WHEN status IN ('finalized', 'reverted') THEN FALSE ELSE active END, updated_at = NOW() WHERE id = $1 AND NOT fill_emitted"
}
_ => anyhow::bail!("Unknown execution event marker {event}"),
};
let result = sqlx::query(statement)
.bind(intent_id)
.execute(&self.pool)
.await
.map_err(|e| anyhow::anyhow!("Failed to mark execution {event} emitted: {e}"))?;
anyhow::ensure!(
result.rows_affected() == 1,
"Execution intent {intent_id} cannot mark {event} emitted"
);
Ok(())
}
/// Updates the status of a persisted execution transaction record.
///
/// # Errors
///
/// Returns an error if the database operation fails.View on GitHub (pinned to 18893faf8b)