{"record":{"id":"32d152e13bbbc24a","repo":"nautechsystems/nautilus_trader","slug":"invalid-ibordertags-conditions-e","errorCode":null,"errorMessage":"Invalid IBOrderTags conditions: {e}","messagePattern":"Invalid IBOrderTags conditions: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/execution/transform/tags.rs","lineNumber":400,"sourceCode":"\n    match create_ib_conditions(&Value::Array(conditions_array.clone())) {\n        Ok(conditions) => {\n            if conditions.is_empty() {\n                return Ok(());\n            }\n\n            ib_order.conditions = conditions;\n            tracing::debug!(\"Setting {} conditions on order\", ib_order.conditions.len());\n\n            if let Some(conditions_cancel_order) = tags_obj\n                .get(\"conditionsCancelOrder\")\n                .and_then(|v| v.as_bool())\n            {\n                ib_order.conditions_cancel_order = conditions_cancel_order;\n            }\n            Ok(())\n        }\n        Err(e) => Err(anyhow::anyhow!(\"Invalid IBOrderTags conditions: {e}\")),\n    }\n}\n\nfn parse_ib_order_type(value: &str) -> Option<IbOrderType> {\n    let upper = value.to_ascii_uppercase();\n    IbOrderType::from_str(value)\n        .or_else(|_| IbOrderType::from_str(&upper))\n        .ok()\n}\n\nfn parse_ib_tif(value: &str) -> Option<IbTimeInForce> {\n    let upper = value.to_ascii_uppercase();\n    IbTimeInForce::from_str(value)\n        .or_else(|_| IbTimeInForce::from_str(&upper))\n        .ok()\n}\n\nfn apply_non_guaranteed_combo_tag(ib_order: &mut IBOrder, value: &Value) -> anyhow::Result<()> {","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/execution/transform/tags.rs#L382-L418","documentation":"apply_ib_order_conditions parses the 'conditions' section of an IBOrderTags JSON payload and converts it into IB order condition objects. When that parsing fails (the inner `e`), the function returns this error, aborting the tag application so no partially-formed conditions reach the ib_order. Conditions control auxiliary IB behaviors such as cancel-on-fill of related orders.","triggerScenarios":"Calling apply_ib_order_tag_json with a payload whose 'conditions' object/array does not match the expected IBOrderTags conditions schema (missing keys, wrong types, malformed structure), producing inner error `e`.","commonSituations":"Hand-writing a tags JSON with a misspelled condition key; passing conditions as a string instead of a JSON object; version drift between the tool that emits the tags JSON and the adapter that consumes it.","solutions":["Inspect the inner error `e` in the message to see the exact conditions parse failure.","Fix the 'conditions' structure in the tags JSON to match the expected IBOrderTags conditions schema (correct keys and value types).","Serialize conditions programmatically from the IBOrderTags structs instead of hand-writing JSON.","Keep the tags producer and adapter versions in sync."],"exampleFix":"// before\n{\"conditions\": \"use_default\"} // wrong type\n// after\n{\"conditions\": {\"conditions_cancel_order\": true}}","handlingStrategy":"validation","validationCode":"let v: serde_json::Value = serde_json::from_str(tags_json)?;\nif let Some(c) = v.get(\"conditions\") {\n    serde_json::from_value::<IbOrderConditions>(c.clone())?; // fail fast, better error\n}","typeGuard":null,"tryCatchPattern":"match apply_ib_order_tag_json(&mut order, &tags_json) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"Invalid IBOrderTags conditions\") => {\n        log::error!(\"malformed conditions in tags payload: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Serialize conditions from structs, never hand-write the JSON","Validate tags JSON against the conditions schema in CI","Test the full tags payload through apply_ib_order_tag_json before live use"],"tags":["order-tags","conditions","json"],"backgroundTag":"invalid-json-response","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"}