{"record":{"id":"15eb37f40dec3f77","repo":"nautechsystems/nautilus_trader","slug":"gamma-scope-filter-key-must-contain-non-empt","errorCode":null,"errorMessage":"Gamma {scope} filter '{key}' must contain non-empty comma-separated values","messagePattern":"Gamma (.+?) filter '(.+?)' must contain non-empty comma-separated values","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/providers.rs","lineNumber":1004,"sourceCode":"    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)\n        .map(str::to_string)\n        .collect::<Vec<_>>();\n\n    if values.is_empty() || values.iter().any(String::is_empty) {\n        anyhow::bail!(\"Gamma {scope} filter '{key}' must contain non-empty comma-separated values\")\n    }\n    Ok(values)\n}\n\nfn parse_gamma_numeric_filter_list(\n    scope: &str,\n    key: &str,\n    value: &str,\n) -> anyhow::Result<Vec<u64>> {\n    parse_gamma_filter_list(scope, key, value)?\n        .into_iter()\n        .map(|item| {\n            item.parse::<u64>().map_err(|e| {\n                anyhow::anyhow!(\n                    \"Gamma {scope} filter '{key}' values must be unsigned integers: {e}\"\n                )\n            })\n        })","sourceCodeStart":986,"sourceCodeEnd":1022,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/providers.rs#L986-L1022","documentation":"List-valued Gamma filters must be non-empty, comma-separated strings with no blank entries. parse_gamma_filter_list splits on ',' and trims each item; empty results or any empty item trigger this error.","triggerScenarios":"Passing '', '   ', 'a,,b', or ',x' for a list filter key (e.g. tag ids or slugs) in a market filter map.","commonSituations":"Joining an empty Vec with ','; optional filters left as empty strings from config; trailing commas from user input or CSV round-trips.","solutions":["Remove the key entirely when there is nothing to filter on, instead of passing an empty string","Fix the value so all comma-separated entries are non-empty (e.g. '1,2,3')","Filter empty items in the caller and skip setting the key if the result is empty"],"exampleFix":"// before\nlet list = tags.join(\",\"); // tags is empty -> \"\"\nfilters.insert(\"tag_id\".into(), list);\n// after\nif !tags.is_empty() {\n    filters.insert(\"tag_id\".into(), tags.join(\",\"));\n}","handlingStrategy":"validation","validationCode":"fn gamma_list(v: &str) -> Option<String> {\n    let items: Vec<&str> = v.split(',').map(str::trim).filter(|s| !s.is_empty()).collect();\n    if items.is_empty() { None } else { Some(items.join(\",\")) }\n}","typeGuard":"fn is_valid_gamma_list(v: &str) -> bool {\n    !v.is_empty() && v.split(',').all(|s| !s.trim().is_empty())\n}","tryCatchPattern":null,"preventionTips":["Skip inserting list filters when the source list is empty","Trim items and drop empties before joining","Reject trailing commas in user input"],"tags":["rust","validation","filters","parsing"],"backgroundTag":"empty-required-field","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"}