{"record":{"id":"58f68646cb4e742f","repo":"nautechsystems/nautilus_trader","slug":"invalid-ibordertags-field-field-e","errorCode":null,"errorMessage":"Invalid IBOrderTags field {field}: {e}","messagePattern":"Invalid IBOrderTags field (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/execution/transform/tags.rs","lineNumber":127,"sourceCode":"    let previous = order_obj.insert(field.to_string(), value);\n\n    match serde_json::from_value::<IBOrder>(order_value.clone()) {\n        Ok(updated_order) => {\n            *ib_order = updated_order;\n            Ok(())\n        }\n        Err(e) => {\n            let Some(order_obj) = order_value.as_object_mut() else {\n                anyhow::bail!(\n                    \"Failed to restore IB order JSON after invalid IBOrderTags field: {field}\"\n                );\n            };\n\n            match previous {\n                Some(previous) => order_obj.insert(field.to_string(), previous),\n                None => order_obj.remove(field),\n            };\n            Err(anyhow::anyhow!(\"Invalid IBOrderTags field {field}: {e}\"))\n        }\n    }\n}\n\nfn sync_order_field(\n    order_value: &mut Value,\n    field: &str,\n    ib_order: &IBOrder,\n) -> anyhow::Result<()> {\n    let updated_order_value = serde_json::to_value(ib_order).with_context(|| {\n        format!(\"Failed to serialize IB order after applying IBOrderTags field: {field}\")\n    })?;\n\n    let Some(updated_field_value) = updated_order_value.get(field).cloned() else {\n        return Ok(());\n    };\n\n    if let Some(order_obj) = order_value.as_object_mut() {","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/execution/transform/tags.rs#L109-L145","documentation":"The IBOrderTags overlay mechanism validates each field name against the known IBOrderTags schema before applying an update to an ib_order JSON representation. When apply_order_field_update receives a field name the schema does not recognize (or the value fails field-level validation, error `e`), it rolls the order object back to its previous state and returns this error. The overlay is rejected wholesale so a partially-applied tag set is never sent to IB.","triggerScenarios":"Calling apply_ib_order_tag_overlay with an IBOrderTags map containing a key not in the IBOrderTags field enum/schema, or a value that fails parsing/validation for a known field (the wrapped `e`).","commonSituations":"Typo in a tag key in an order-tags config/JSON payload; a tag added by a newer/older adapter version that the schema does not know; pasting tags from documentation for a different adapter.","solutions":["Correct the field name in the IBOrderTags input to one of the supported schema fields.","Check the wrapped error `e` in the message to see which value failed validation for a known field and fix its format.","Align the adapter version producing the tags with the version applying them so both share the same schema.","Validate the tags JSON against the IBOrderTags schema locally before applying the overlay."],"exampleFix":"// before\nlet tags = r#\"{ \"trailType\": \"abs\" }\"#; // unknown field\n// after\nlet tags = r#\"{ \"order_type\": \"TRAIL\" }\"#; // valid IBOrderTags field","handlingStrategy":"validation","validationCode":"// validate keys against known IBOrderTags fields before overlay\nfor key in tags_map.keys() {\n    assert!(SUPPORTED_IB_ORDER_TAG_FIELDS.contains(&key.as_str()), \"unknown IBOrderTags field: {key}\");\n}","typeGuard":null,"tryCatchPattern":"match apply_ib_order_tag_overlay(&mut order, &tags) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"Invalid IBOrderTags field\") => {\n        log::warn!(\"dropping invalid tags: {e}\"); // order left unchanged by rollback\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Generate tags JSON from typed IBOrderTags structs instead of hand-writing keys","Keep tag producer and adapter versions in sync","Lint tags config against the IBOrderTags schema before deployment"],"tags":["order-tags","schema","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}