nautechsystems/nautilus_trader · error · anyhow::Error

Unsupported IBOrderTags field: {field}

Error message

Unsupported IBOrderTags field: {field}

What it means

IBOrderTags overlays only allow fields that already exist on the serialized IBOrder (order_obj.contains_key(field)). Setting a field IBOrder does not define is rejected so the tag map cannot inject unknown fields into the order.

Source

Thrown at crates/adapters/interactive_brokers/src/execution/transform/tags.rs:106

            apply_order_field_update(ib_order, &mut order_value, &field, value)?;
        }
    }

    Ok(())
}

fn apply_order_field_update(
    ib_order: &mut IBOrder,
    order_value: &mut Value,
    field: &str,
    value: Value,
) -> anyhow::Result<()> {
    let Some(order_obj) = order_value.as_object_mut() else {
        anyhow::bail!("Failed to apply IBOrderTags because IB order JSON is not an object");
    };

    if !order_obj.contains_key(field) {
        anyhow::bail!("Unsupported IBOrderTags field: {field}");
    }

    let previous = order_obj.insert(field.to_string(), value);

    match serde_json::from_value::<IBOrder>(order_value.clone()) {
        Ok(updated_order) => {
            *ib_order = updated_order;
            Ok(())
        }
        Err(e) => {
            let Some(order_obj) = order_value.as_object_mut() else {
                anyhow::bail!(
                    "Failed to restore IB order JSON after invalid IBOrderTags field: {field}"
                );
            };

            match previous {
                Some(previous) => order_obj.insert(field.to_string(), previous),

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use only fields the crate's IBOrder struct actually serializes (inspect a serialized IBOrder or its serde definitions)
  2. Request/patch support for the missing field on IBOrder, then rebuild
  3. Remove the unsupported tag and configure the equivalent behavior through the adapter's own config or policy functions

Example fix

// before
{"min_trade_qty": 1}
// after
// remove the tag or implement the field on IBOrder first
Defensive patterns

Strategy: validation

Validate before calling

let serialized = serde_json::to_value(&ib_order)?;
for field in tags.keys() {
    if !serialized.as_object().map_or(false, |o| o.contains_key(field)) {
        return Err(anyhow::anyhow!("tag field not on IBOrder: {field}"));
    }
}

Prevention

When it happens

Trigger: apply_ib_order_tag_overlay -> apply_order_field_update with a tag key that normalize_order_tag_update accepted but which is not a key in the serialized IBOrder JSON — typically a field present in IB's API but not modeled on this crate's IBOrder struct.

Common situations: Trying to set newer IB API fields (e.g. fields added in later TWS API versions) that the adapter's IBOrder struct doesn't serialize; using deprecated/renamed field names.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/05b7276b64ba4bfe. Report an issue: GitHub.