nautechsystems/nautilus_trader · error
{FAILED}: {e}
Error message
{FAILED}: {e} What it means
OrderInitialized::new panics with a {FAILED}: {e} message when the underlying fallible constructor returns an error (e.g. invalid instrument ID, trader/account ID format, or other model validation failure). The public API trades a Result for a panic, surfacing the inner error text after the FAILED prefix.
Source
Thrown at crates/model/src/events/order/initialized.rs:317
trigger_price,
trigger_type,
limit_offset,
trailing_offset,
trailing_offset_type,
expire_time,
display_qty,
emulation_trigger,
trigger_instrument_id,
contingency_type,
order_list_id,
linked_order_ids,
parent_order_id,
exec_algorithm_id,
exec_algorithm_params,
exec_spawn_id,
tags,
)
.unwrap_or_else(|e| panic!("{FAILED}: {e}"))
}
}
impl Debug for OrderInitialized {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}(\
trader_id={}, \
strategy_id={}, \
instrument_id={}, \
client_order_id={}, \
side={}, \
type={}, \
quantity={}, \
time_in_force={}, \
post_only={}, \
reduce_only={}, \View on GitHub (pinned to 18893faf8b)
Solutions
- Validate all IDs (InstrumentId, AccountId, StrategyId, ExecAlgorithmId) with their TryFrom/parse before calling new
- Correct the malformed identifier in your configuration or event source
- If you cannot panic, build via the fallible inner constructor path in your own wrapper
Example fix
// before
let event = OrderInitialized::new(..., instrument_id, ...); // panics on bad ID
// after
let instrument_id = InstrumentId::from_str("BTCUSDT.BINANCE")?;
let event = OrderInitialized::new(..., instrument_id, ...); Defensive patterns
Strategy: validation
Validate before calling
// Validate identifiers before constructing the event
fn id_ok(s: &str) -> bool {
InstrumentId::from_str(s).is_ok()
&& AccountId::from_str(&acct).is_ok()
&& StrategyId::from_str(&strategy).is_ok()
} Try / catch
// Wrap construction if panics are unacceptable
let event = std::panic::catch_unwind(|| OrderInitialized::new(...))
.map_err(|_| anyhow::anyhow!("OrderInitialized construction failed"))?; Prevention
- Parse all IDs with their TryFrom impls at config-load time
- Centralize order event construction in one validated code path
- Log the raw identifiers when construction fails to speed diagnosis
When it happens
Trigger: Calling OrderInitialized::new with malformed IDs (invalid InstrumentId, AccountId, StrategyId, UUID4, etc.) or parameters that fail the inner model validation, causing unwrap_or_else to panic.
Common situations: Config files with mistyped instrument or strategy identifiers; programmatically generated IDs missing expected separators; deserializing orders from a feed with different ID conventions.
Related errors
- {e}
- Invalid `OrderEventAny` not `OrderFilled`, was {event:?}
- Order invariant violated: first event must be OrderInitializ
- {FAILED}: {e}
- {FAILED}: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e3435d8fc2bac8e2.
Report an issue: GitHub.