nautechsystems/nautilus_trader · error · anyhow::Error
Gamma {scope} filter '{key}' values must be unsigned integer
Error message
Gamma {scope} filter '{key}' values must be unsigned integers: {e} What it means
parse_gamma_numeric_filter_list first splits a comma-separated Gamma filter into a list (parse_gamma_filter_list) then parses each element as u64. If any individual element fails u64 parsing, the whole filter fails with 'Gamma {scope} filter {key} values must be unsigned integers'.
Source
Thrown at crates/adapters/polymarket/src/providers.rs:1018
.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}"
)
})
})
.collect()
}
fn parse_gamma_filter_string(scope: &str, key: &str, value: &str) -> anyhow::Result<String> {
if value.trim().is_empty() {
anyhow::bail!("Gamma {scope} filter '{key}' cannot be empty")
}
Ok(value.to_string())
}
/// Resolves a tag slug to a tag ID by querying the Gamma tags endpoint.
pub async fn resolve_tag_slug(
client: &PolymarketGammaHttpClient,
slug: &str,View on GitHub (pinned to 18893faf8b)
Solutions
- Ensure every comma-separated element is a bare non-negative integer, e.g. "1,2,3"
- Remove empty segments caused by trailing commas; trim whitespace around each item (the parser trims only after splitting)
- Validate the list in the caller with a parse::<u64> check before building params
- If a mixed-type list is needed, use the non-numeric list filter variant instead
Example fix
// before
filters.insert("tag_ids", "12, 34,");
// after
filters.insert("tag_ids", "12,34"); Defensive patterns
Strategy: validation
Validate before calling
// Rust
fn is_u64_list(v: &str) -> bool {
v.split(',').map(str::trim).all(|s| s.parse::<u64>().is_ok())
} Prevention
- Join list filters from typed numeric collections, not hand-written strings
- Avoid trailing commas in list config values
- Validate each element with parse::<u64> at config load time
When it happens
Trigger: Passing a comma-separated list filter where at least one element is not a plain non-negative integer, e.g. "123, abc" or "1, 2.5, 3".
Common situations: Lists built by joining IDs with names, trailing commas producing empty elements, or list values accidentally nested/quoted in config.
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
- Gamma {scope} filter '{key}' must be an unsigned integer: {e
- fee exponent must be non-negative
- Gamma {scope} filter '{key}' must be a decimal number: {e}
- unrecognized side '{side}'
- quantity size={} cannot be represented with precision={}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/96f7c39a4ec67ffe.
Report an issue: GitHub.