nautechsystems/nautilus_trader · error
Unknown Gamma event filter key '{key}'
Error message
Unknown Gamma event filter key '{key}' What it means
build_gamma_params_from_hashmap's event counterpart accepts only a fixed allowlist of Gamma event filter keys (end_date_min, tag_slug, order, limit, etc.). Any other key is rejected with this error. It prevents typos and event API keys leaking into requests.
Source
Thrown at crates/adapters/polymarket/src/providers.rs:842
///
/// # Errors
///
/// Returns an error for unknown keys, malformed values, or invalid filter combinations.
pub fn build_gamma_event_params_from_hashmap(
map: &HashMap<String, String>,
) -> anyhow::Result<GetGammaEventsParams> {
for key in map.keys() {
match key.as_str() {
"is_active" | "active" | "closed" | "archived" | "id" | "slug" | "live"
| "featured" | "cyom" | "title_search" | "liquidity_min" | "liquidity_max"
| "volume_min" | "volume_max" | "start_date_min" | "start_date_max"
| "end_date_min" | "end_date_max" | "start_time_min" | "start_time_max" | "tag_id"
| "tag_slug" | "exclude_tag_id" | "related_tags" | "tag_match" | "series_id"
| "game_id" | "event_date" | "event_week" | "featured_order" | "recurrence"
| "created_by" | "parent_event_id" | "include_children" | "partner_slug"
| "include_chat" | "include_template" | "include_best_lines" | "locale" | "order"
| "ascending" | "limit" | "offset" | "max_events" => {}
_ => anyhow::bail!("Unknown Gamma event filter key '{key}'"),
}
}
let mut params = GetGammaEventsParams::default();
if map
.get("is_active")
.map(|value| parse_gamma_filter_bool("event", "is_active", value))
.transpose()?
.unwrap_or(false)
{
params.active = Some(true);
params.archived = Some(false);
params.closed = Some(false);
}
macro_rules! set_bool {
($field:ident) => {View on GitHub (pinned to 18893faf8b)
Solutions
- Verify the key against the event filter allowlist (end_date_min, start_date_min, tag_id, tag_slug, order, ascending, limit, offset, etc.)
- Correct or remove the offending key from the filter map
- Build filters with a typed struct or constants rather than free-form strings
Example fix
// before
let filters = hashmap!{"tagid" => "1"};
provider.query_events(filters).await?;
// after
let filters = hashmap!{"tag_id" => "1"};
provider.query_events(filters).await?; Defensive patterns
Strategy: validation
Validate before calling
const EVENT_KEYS: &[&str] = &["end_date_min","end_date_max","tag_id","tag_slug","order","ascending","limit","offset","recurrence"];
for k in filters.keys() {
assert!(EVENT_KEYS.contains(&k.as_str()), "unknown Gamma event filter: {k}");
} Try / catch
match provider.query_events(filters).await {
Err(e) if e.to_string().contains("Unknown Gamma event filter") => {
eprintln!("bad event filter key: {e}");
}
r => r?,
} Prevention
- Define event filter keys as typed constants
- Validate filters before query_events in wrappers
- Keep market and event filter builders separate
When it happens
Trigger: Calling query_events with a filter map containing a key not in the event allowlist, such as a market-only key or a misspelled parameter.
Common situations: Typos like 'tagid' instead of 'tag_id'; reusing market filter maps for event queries; using removed parameters from older Gamma API docs.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- Unknown Gamma market filter key '{key}'
- Gamma {scope} filter '{key}' must be true or false, was '{va
- Gamma {scope} filter '{key}' must contain non-empty comma-se
- Gamma {scope} filter '{key}' cannot be empty
- {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/6c19cfa5e835987c.
Report an issue: GitHub.