{"record":{"id":"f9b5697cb87995b3","repo":"nautechsystems/nautilus_trader","slug":"gamma-scope-filter-key-must-be-an-unsigned-i","errorCode":null,"errorMessage":"Gamma {scope} filter '{key}' must be an unsigned integer: {e}","messagePattern":"Gamma (.+?) filter '(.+?)' must be an unsigned integer: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/providers.rs","lineNumber":981,"sourceCode":"    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}\"))\n}\n\nfn parse_gamma_filter_list(scope: &str, key: &str, value: &str) -> anyhow::Result<Vec<String>> {\n    let values = value\n        .split(',')\n        .map(str::trim)","sourceCodeStart":963,"sourceCodeEnd":999,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/providers.rs#L963-L999","documentation":"parse_gamma_filter_u32 parses a string filter value as u32 for Gamma market/event filters. When value.parse::<u32>() fails (empty string, negative number, float, non-numeric, or value > u32::MAX), it wraps the parse error into 'Gamma {scope} filter {key} must be an unsigned integer'.","triggerScenarios":"Supplying a market or event filter (scope='market' or 'event') whose value cannot parse as u32, e.g. max_markets=\"all\", max_markets=\"-1\", or max_markets=\"1.5\" in the filter hashmap.","commonSituations":"Typos in config files (\"3,000\" with comma), shell quoting producing empty strings, users entering floats or signed numbers for count-like filters.","solutions":["Set the filter value to a plain non-negative integer string, e.g. \"50\"","Strip whitespace, thousands separators, and quotes from the config value before passing it","Clamp or round user input to an integer in the calling layer before building params","If a value near 4 billion is needed, confirm it fits u32; otherwise check for the u64 variant"],"exampleFix":"// before\nparams.max_markets = Some(\"1.5\".to_string());\n// after\nparams.max_markets = Some(\"2\".to_string());","handlingStrategy":"validation","validationCode":"// Rust\nfn is_u32_filter(v: &str) -> bool { v.trim().parse::<u32>().is_ok() }\nassert!(is_u32_filter(\"50\"));\nassert!(!is_u32_filter(\"1.5\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store numeric filters as typed integers in config, not strings, and stringify only at the boundary","Trim and strip separators from config strings before passing them as filters","Add unit tests for filter parsing with representative bad inputs"],"tags":["validation","parsing","integer","polymarket","gamma-api"],"backgroundTag":"invalid-argument-value","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"}