{"record":{"id":"ef73917ebc73b952","repo":"nautechsystems/nautilus_trader","slug":"gamma-scope-filter-key-must-be-true-or-false","errorCode":null,"errorMessage":"Gamma {scope} filter '{key}' must be true or false, was '{value}'","messagePattern":"Gamma (.+?) filter '(.+?)' must be true or false, was '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/providers.rs","lineNumber":975,"sourceCode":"    set_decimal!(volume_min);\n    set_decimal!(volume_max);\n    set_u32!(event_week);\n    set_u32!(limit);\n    set_u32!(offset);\n    set_u32!(max_events);\n    set_u64!(parent_event_id);\n\n    params.validate_keyset().map_err(anyhow::Error::msg)?;\n    Ok(params)\n}\n\nfn parse_gamma_filter_bool(scope: &str, key: &str, value: &str) -> anyhow::Result<bool> {\n    if value.eq_ignore_ascii_case(\"true\") {\n        Ok(true)\n    } else if value.eq_ignore_ascii_case(\"false\") {\n        Ok(false)\n    } else {\n        anyhow::bail!(\"Gamma {scope} filter '{key}' must be true or false, was '{value}'\")\n    }\n}\n\nfn parse_gamma_filter_u32(scope: &str, key: &str, value: &str) -> anyhow::Result<u32> {\n    value.parse::<u32>().map_err(|e| {\n        anyhow::anyhow!(\"Gamma {scope} filter '{key}' must be an unsigned integer: {e}\")\n    })\n}\n\nfn parse_gamma_filter_u64(scope: &str, key: &str, value: &str) -> anyhow::Result<u64> {\n    value.parse::<u64>().map_err(|e| {\n        anyhow::anyhow!(\"Gamma {scope} filter '{key}' must be an unsigned integer: {e}\")\n    })\n}\n\nfn parse_gamma_filter_decimal(scope: &str, key: &str, value: &str) -> anyhow::Result<Decimal> {\n    parse_decimal_exact(value)\n        .map_err(|e| anyhow::anyhow!(\"Gamma {scope} filter '{key}' must be a decimal number: {e}\"))","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/providers.rs#L957-L993","documentation":"Certain Gamma filters (e.g. boolean flags like include_tag-style options) must be the string 'true' or 'false' (case-insensitive). parse_gamma_filter_bool raises this error for any other value, since the Gamma API expects strict booleans.","triggerScenarios":"Supplying values like 'yes', '1', 'TRUE ', 'on', or an empty string for a boolean filter key in a markets or events filter map.","commonSituations":"Reading filter values from env vars or config files where '1'/'0' or 'yes'/'no' conventions are used; user-supplied query strings; YAML/TOML booleans stringified inconsistently.","solutions":["Change the value to exactly 'true' or 'false' (any case is accepted)","Normalize the input: parse it as a bool in the caller (parse::<bool> or a config bool) and stringify as 'true'/'false'","If the source uses 1/0 or yes/no, map those explicitly before passing"],"exampleFix":"// before\nfilters.insert(\"active\".into(), \"1\".into());\n// after\nfilters.insert(\"active\".into(), \"true\".into());","handlingStrategy":"validation","validationCode":"fn as_gamma_bool(v: &str) -> Option<&str> {\n    match v.to_ascii_lowercase().as_str() {\n        \"true\" => Some(\"true\"),\n        \"false\" => Some(\"false\"),\n        _ => None,\n    }\n}","typeGuard":"fn is_gamma_bool(v: &str) -> bool {\n    v.eq_ignore_ascii_case(\"true\") || v.eq_ignore_ascii_case(\"false\")\n}","tryCatchPattern":null,"preventionTips":["Normalize 1/0, yes/no to true/false at config load","Use typed bool fields in config instead of strings","Trim values before validation"],"tags":["rust","validation","filters","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}