nautechsystems/nautilus_trader · critical
provider condition {condition_id} does not match instrument
Error message
provider condition {condition_id} does not match instrument condition {instrument_condition} What it means
Before reconciling an order or fill, the code binds the provider object to the local instrument by comparing condition_id metadata. This error fires when the condition_id from the provider (order or trade) does not match the condition_id stored in the instrument's info metadata (case-insensitively), meaning the order/fill belongs to a different market than the instrument.
Source
Thrown at crates/adapters/polymarket/src/execution/reconciliation.rs:252
trade_id,
})
}
fn validate_instrument_binding(
instrument: &InstrumentAny,
condition_id: &str,
outcome: PolymarketOutcome,
) -> anyhow::Result<()> {
let InstrumentAny::BinaryOption(binary) = instrument else {
anyhow::bail!("expected Polymarket BinaryOption instrument, found {instrument:?}");
};
let instrument_condition = binary
.info
.as_ref()
.and_then(|info| info.get_str("condition_id"))
.context("Polymarket instrument is missing condition_id metadata")?;
anyhow::ensure!(
instrument_condition.eq_ignore_ascii_case(condition_id),
"provider condition {condition_id} does not match instrument condition {instrument_condition}",
);
let instrument_outcome = binary
.outcome
.context("Polymarket instrument is missing outcome metadata")?;
anyhow::ensure!(
instrument_outcome == outcome.as_str(),
"provider outcome {outcome} does not match instrument outcome {instrument_outcome}",
);
Ok(())
}
fn validate_quantity_evidence(
value: Decimal,
precision: u8,
field: &str,View on GitHub (pinned to 18893faf8b)
Solutions
- Print both condition_ids and confirm which is correct; refetch the market definition from Polymarket.
- Rebuild the instrument from the current market metadata so info.condition_id matches the live market.
- Check the instrument/venue configuration for a copied or outdated condition_id.
- Verify any instrument cache is invalidated when the market is re-created or resolved.
Example fix
// before
let instrument = load_instrument_cached(symbol)?;
validate_instrument_binding(&order, &instrument)?;
// after: refresh instrument when condition ids diverge
let instrument = load_instrument_cached(symbol)?;
if !condition_matches(&order, &instrument) {
let instrument = reload_instrument_from_provider(symbol)?;
validate_instrument_binding(&order, &instrument)?;
} Defensive patterns
Strategy: validation
Validate before calling
fn condition_matches(instrument: &Instrument, condition_id: &str) -> bool {
instrument.info.as_ref()
.and_then(|i| i.get_str("condition_id"))
.map(|c| c.eq_ignore_ascii_case(condition_id))
.unwrap_or(false)
} Type guard
fn bound_to_condition(instrument: &Instrument, condition_id: &str) -> Option<&Instrument> {
condition_matches(instrument, condition_id).then_some(instrument)
} Try / catch
match validate_instrument_binding(&order, &instrument) {
Ok(()) => (),
Err(e) if e.to_string().contains("condition") => reload_instrument_and_retry(&symbol)?,
Err(e) => return Err(e),
} Prevention
- Always build instruments from live market metadata, never hardcoded condition_ids
- Invalidate instrument caches when markets resolve or are re-created
- Log both condition ids on mismatch for fast diagnosis
When it happens
Trigger: build_order_report_from_order, classify_target_trade, or build_fill_reports_from_trades -> validate_instrument_binding is called with a provider object whose condition_id differs from binary.info["condition_id"].
Common situations: Subscribing/reconciling with an instrument built from a stale market config while the venue moved the market to a new condition_id; hardcoding or mis-copying a token/condition id in config; a market resolved and re-deployed with a new condition id.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- provider outcome {outcome} does not match instrument outcome
- Polymarket execution shutdown failed: {}
- Polymarket CLOB protocol version {version} is unsupported; a
- provider venue order {} is not owned by the account
- unmapped in-scope open order instrument {instrument_id} (tok
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/feb0f6c2ba1dbdd3.
Report an issue: GitHub.