nautechsystems/nautilus_trader · error
Gamma {scope} filter '{key}' must contain non-empty comma-se
Error message
Gamma {scope} filter '{key}' must contain non-empty comma-separated values What it means
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.
Source
Thrown at crates/adapters/polymarket/src/providers.rs:1004
value.parse::<u64>().map_err(|e| {
anyhow::anyhow!("Gamma {scope} filter '{key}' must be an unsigned integer: {e}")
})
}
fn parse_gamma_filter_decimal(scope: &str, key: &str, value: &str) -> anyhow::Result<Decimal> {
parse_decimal_exact(value)
.map_err(|e| anyhow::anyhow!("Gamma {scope} filter '{key}' must be a decimal number: {e}"))
}
fn parse_gamma_filter_list(scope: &str, key: &str, value: &str) -> anyhow::Result<Vec<String>> {
let values = value
.split(',')
.map(str::trim)
.map(str::to_string)
.collect::<Vec<_>>();
if values.is_empty() || values.iter().any(String::is_empty) {
anyhow::bail!("Gamma {scope} filter '{key}' must contain non-empty comma-separated values")
}
Ok(values)
}
fn parse_gamma_numeric_filter_list(
scope: &str,
key: &str,
value: &str,
) -> anyhow::Result<Vec<u64>> {
parse_gamma_filter_list(scope, key, value)?
.into_iter()
.map(|item| {
item.parse::<u64>().map_err(|e| {
anyhow::anyhow!(
"Gamma {scope} filter '{key}' values must be unsigned integers: {e}"
)
})
})View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let list = tags.join(","); // tags is empty -> ""
filters.insert("tag_id".into(), list);
// after
if !tags.is_empty() {
filters.insert("tag_id".into(), tags.join(","));
} Defensive patterns
Strategy: validation
Validate before calling
fn gamma_list(v: &str) -> Option<String> {
let items: Vec<&str> = v.split(',').map(str::trim).filter(|s| !s.is_empty()).collect();
if items.is_empty() { None } else { Some(items.join(",")) }
} Type guard
fn is_valid_gamma_list(v: &str) -> bool {
!v.is_empty() && v.split(',').all(|s| !s.trim().is_empty())
} Prevention
- Skip inserting list filters when the source list is empty
- Trim items and drop empties before joining
- Reject trailing commas in user input
When it happens
Trigger: Passing '', ' ', 'a,,b', or ',x' for a list filter key (e.g. tag ids or slugs) in a market filter map.
Common situations: Joining an empty Vec with ','; optional filters left as empty strings from config; trailing commas from user input or CSV round-trips.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Gamma {scope} filter '{key}' must be true or false, was '{va
- Gamma {scope} filter '{key}' cannot be empty
- Unknown Gamma market filter key '{key}'
- Unknown Gamma event filter key '{key}'
- invalid Derive `expired` filter: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/15eb37f40dec3f77.
Report an issue: GitHub.