nautechsystems/nautilus_trader · error
Cannot unsubscribe from synthetic instrument `InstrumentStat
Error message
Cannot unsubscribe from synthetic instrument `InstrumentStatus` data
What it means
InstrumentStatus subscriptions never exist for synthetic instruments, so the corresponding unsubscribe is likewise impossible. UnsubscribeCommand::InstrumentStatus with a synthetic instrument ID is rejected with this error.
Source
Thrown at crates/data/src/engine/mod.rs:1274
UnsubscribeCommand::Quotes(cmd) if cmd.instrument_id.is_synthetic() => {
self.unsubscribe_synthetic_quotes(cmd.instrument_id);
return Ok(());
}
UnsubscribeCommand::Quotes(cmd)
if self.is_spread_quote_command(cmd.instrument_id, cmd.params.as_ref()) =>
{
self.unsubscribe_spread_quotes(cmd);
return Ok(());
}
UnsubscribeCommand::Trades(cmd) if cmd.instrument_id.is_synthetic() => {
self.unsubscribe_synthetic_trades(cmd.instrument_id);
return Ok(());
}
UnsubscribeCommand::Instrument(cmd) if cmd.instrument_id.is_synthetic() => {
anyhow::bail!("Cannot unsubscribe from synthetic instrument `Instrument` data");
}
UnsubscribeCommand::InstrumentStatus(cmd) if cmd.instrument_id.is_synthetic() => {
anyhow::bail!(
"Cannot unsubscribe from synthetic instrument `InstrumentStatus` data"
);
}
UnsubscribeCommand::InstrumentClose(cmd) if cmd.instrument_id.is_synthetic() => {
anyhow::bail!(
"Cannot unsubscribe from synthetic instrument `InstrumentClose` data"
);
}
UnsubscribeCommand::OptionGreeks(cmd) if cmd.instrument_id.is_synthetic() => {
anyhow::bail!("Cannot unsubscribe from synthetic instrument `OptionGreeks` data");
}
_ => {}
}
if let Some(client) = self.get_command_client(cmd.client_id(), cmd.venue()) {
client.execute_unsubscribe(cmd);
} else {
log::error!(View on GitHub (pinned to 18893faf8b)
Solutions
- Guard InstrumentStatus unsubscribes with an is_synthetic() check and skip synthetic IDs.
- Maintain a record of live subscriptions and only issue matching unsubscribes.
- Resolve the mismatch if synthetic IDs unexpectedly appear in your real-instrument teardown list.
Example fix
// before
for id in &instrument_ids {
engine.unsubscribe_instrument_status(*id)?;
}
// after
for id in instrument_ids.iter().filter(|id| !id.is_synthetic()) {
engine.unsubscribe_instrument_status(*id)?;
} Defensive patterns
Strategy: type-guard
Validate before calling
// Rust
if !instrument_id.is_synthetic() {
engine.unsubscribe_instrument_status(instrument_id)?;
} Type guard
// Rust
fn was_ever_subscribed(id: &InstrumentId, cmd: &UnsubscribeCommand) -> bool {
!id.is_synthetic() // InstrumentStatus is never subscribed for synthetics
} Try / catch
// Rust
if let Err(e) = engine.unsubscribe_instrument_status(id) {
if e.to_string().contains("unsubscribe from synthetic instrument `InstrumentStatus`") {
log::debug!("no InstrumentStatus subscription existed for synthetic {id}");
} else {
return Err(e.into());
}
} Prevention
- Keep a subscription ledger and unsubscribe only recorded subscriptions.
- Apply the is_synthetic() filter consistently in both subscribe and unsubscribe paths.
- Make teardown loops resilient: log-and-continue on unsupported unsubscribe targets.
When it happens
Trigger: Calling unsubscribe for InstrumentStatus where the InstrumentId is synthetic (is_synthetic() == true), e.g. blanket teardown loops unsubscribing all data types for all instruments.
Common situations: Strategy shutdown routines that unsubscribe every stream type unconditionally; refactors that changed an instrument ID to a synthetic one without updating subscription bookkeeping.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot unsubscribe from synthetic instrument `Instrument` da
- Cannot unsubscribe from synthetic instrument `InstrumentClos
- Cannot subscribe for synthetic instrument `Instrument` data
- Cannot subscribe for synthetic instrument `InstrumentStatus`
- Cannot subscribe for synthetic instrument `InstrumentClose`
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/3aec00490a761aef.
Report an issue: GitHub.