nautechsystems/nautilus_trader · error · anyhow::Error
Invalid IBOrderTags value for NonGuaranteed: {value}
Error message
Invalid IBOrderTags value for NonGuaranteed: {value} What it means
The NonGuaranteed combo tag must be a boolean-like JSON value (true/false or "1"/"0"-style). parse_bool_like returns None for anything else, and since NonGuaranteed maps into smart_combo_routing_params as "1"/"0", arbitrary values are rejected.
Source
Thrown at crates/adapters/interactive_brokers/src/execution/transform/tags.rs:420
}
fn parse_ib_order_type(value: &str) -> Option<IbOrderType> {
let upper = value.to_ascii_uppercase();
IbOrderType::from_str(value)
.or_else(|_| IbOrderType::from_str(&upper))
.ok()
}
fn parse_ib_tif(value: &str) -> Option<IbTimeInForce> {
let upper = value.to_ascii_uppercase();
IbTimeInForce::from_str(value)
.or_else(|_| IbTimeInForce::from_str(&upper))
.ok()
}
fn apply_non_guaranteed_combo_tag(ib_order: &mut IBOrder, value: &Value) -> anyhow::Result<()> {
let Some(non_guaranteed) = parse_bool_like(value) else {
anyhow::bail!("Invalid IBOrderTags value for NonGuaranteed: {value}");
};
set_tag_value(
&mut ib_order.smart_combo_routing_params,
"NonGuaranteed",
if non_guaranteed { "1" } else { "0" },
);
Ok(())
}
fn parse_bool_like(value: &Value) -> Option<bool> {
if let Some(value) = value.as_bool() {
return Some(value);
}
if let Some(value) = value.as_i64() {
return match value {
0 => Some(false),View on GitHub (pinned to 18893faf8b)
Solutions
- Pass a boolean: {"NonGuaranteed": true}
- If passing a string, use "1" or "0" (verify which string forms parse_bool_like accepts in tags.rs)
- Remove quotes/extra structure so the value is a bare bool or accepted string literal
Example fix
// before
{"NonGuaranteed": "yes"}
// after
{"NonGuaranteed": true} Defensive patterns
Strategy: validation
Validate before calling
let v = &tags["NonGuaranteed"];
let ok = matches!(v, serde_json::Value::Bool(_))
|| matches!(v, serde_json::Value::String(s) if s == "1" || s == "0");
if !ok { return Err(anyhow::anyhow!("NonGuaranteed must be bool or \"1\"/\"0\"")); } Type guard
fn is_bool_like(v: &serde_json::Value) -> bool {
v.is_boolean() || matches!(v, serde_json::Value::String(s) if s == "1" || s == "0")
} Prevention
- Use JSON booleans for flag-like tags, not "yes"/"no"/"on"
- Document the accepted NonGuaranteed forms for combo orders
- Validate combo tag payloads in a pre-submit check
When it happens
Trigger: apply_ib_order_tag_overlay -> apply_non_guaranteed_combo_tag with a NonGuaranteed value that is not bool-like, e.g. {"NonGuaranteed": "yes"}, {"NonGuaranteed": 2}, or a nested object/array.
Common situations: Passing human-friendly strings like "yes"/"no"/"on" into order tags; wrapping the flag in an object; using 1/0 as numbers if parse_bool_like only accepts bool/strings.
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
- Invalid IBOrderTags payload: expected a JSON object
- Invalid IBOrderTags field {field}: {value}
- Unsupported IBOrderTags field: {field}
- instrument_ratios list needs to have at least 2 legs
- ratio cannot be zero
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/02b9b3877b673b6b.
Report an issue: GitHub.