{"record":{"id":"31d105361ff15abb","repo":"nautechsystems/nautilus_trader","slug":"unknown-ib-condition-kind-value","errorCode":null,"errorMessage":"Unknown IB condition kind: {value}","messagePattern":"Unknown IB condition kind: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/common/enums/order.rs","lineNumber":765,"sourceCode":"            Self::Execution => \"execution\",\n            Self::Volume => \"volume\",\n            Self::PercentChange => \"percent_change\",\n        }\n    }\n}\n\nimpl FromStr for IbConditionKind {\n    type Err = anyhow::Error;\n\n    fn from_str(value: &str) -> Result<Self, Self::Err> {\n        match value.to_ascii_lowercase().as_str() {\n            \"price\" => Ok(Self::Price),\n            \"time\" => Ok(Self::Time),\n            \"margin\" => Ok(Self::Margin),\n            \"execution\" => Ok(Self::Execution),\n            \"volume\" => Ok(Self::Volume),\n            \"percent_change\" | \"percentchange\" => Ok(Self::PercentChange),\n            _ => anyhow::bail!(\"Unknown IB condition kind: {value}\"),\n        }\n    }\n}\n\nimpl Display for IbConditionKind {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.write_str(self.as_str())\n    }\n}\n\n/// Interactive Brokers conditional order conjunction values.\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\n#[cfg_attr(\n    feature = \"python\",\n    pyo3::pyclass(\n        module = \"nautilus_trader.adapters.interactive_brokers\",\n        from_py_object,\n        rename_all = \"SCREAMING_SNAKE_CASE\"","sourceCodeStart":747,"sourceCodeEnd":783,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/common/enums/order.rs#L747-L783","documentation":"IbConditionKind::from_str in crates/adapters/interactive_brokers/src/common/enums/order.rs:765 parses IB conditional-order kinds (price, time, margin, execution, volume, percent_change) and bails with anyhow if the lowercase input matches none of them.","triggerScenarios":"Parsing a condition kind string like \"Price\", \"PRICE\", \"pct_change\", \"percentage\", or any other name not in the accepted list (input is lowercased before matching, so only spelling differences matter).","commonSituations":"Building IB conditional orders (e.g. price-triggered) with hand-written kind names; copying condition names from IB TWS UI text rather than the API codes; typos like \"precent_change\".","solutions":["Use one of: \"price\", \"time\", \"margin\", \"execution\", \"volume\", \"percent_change\" (case-insensitive; \"percentchange\" also accepted).","Check spelling against the match arms; note \"pct_change\" is NOT accepted.","Normalize via to_ascii_lowercase + trim before parsing.","Add a new arm upstream if an IB condition kind is missing."],"exampleFix":"// before\nlet k = \"pct_change\".parse::<IbConditionKind>()?; // bail!\n// after\nlet k = \"percent_change\".parse::<IbConditionKind>()?; // Ok(PercentChange)","handlingStrategy":"validation","validationCode":"const IB_CONDITION_KINDS: &[&str] = &[\"price\",\"time\",\"margin\",\"execution\",\"volume\",\"percent_change\",\"percentchange\"];\nfn is_valid_condition_kind(s: &str) -> bool {\n    IB_CONDITION_KINDS.contains(&s.trim().to_ascii_lowercase().as_str())\n}","typeGuard":"fn as_condition_kind(s: &str) -> Option<IbConditionKind> {\n    s.trim().to_ascii_lowercase().parse::<IbConditionKind>().ok()\n}","tryCatchPattern":"match value.parse::<IbConditionKind>() {\n    Ok(kind) => add_condition(kind),\n    Err(e) => log::error!(\"unknown condition kind '{value}': {e}\"),\n}","preventionTips":["Use snake_case API codes, not TWS UI labels, for condition kinds.","Lowercase and trim before parsing; spelling must match exactly (e.g. 'percent_change', not 'pct_change').","Keep a constants list of valid kinds shared with config schemas."],"tags":["rust","enum-parsing","interactive-brokers","conditional-orders"],"backgroundTag":"invalid-enum-value","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"}