{"record":{"id":"73086ae13edac00f","repo":"nautechsystems/nautilus_trader","slug":"tag-slug-slug-not-found","errorCode":null,"errorMessage":"Tag slug '{slug}' not found","messagePattern":"Tag slug '(.+?)' not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/providers.rs","lineNumber":1043,"sourceCode":"\nfn parse_gamma_filter_string(scope: &str, key: &str, value: &str) -> anyhow::Result<String> {\n    if value.trim().is_empty() {\n        anyhow::bail!(\"Gamma {scope} filter '{key}' cannot be empty\")\n    }\n    Ok(value.to_string())\n}\n\n/// Resolves a tag slug to a tag ID by querying the Gamma tags endpoint.\npub async fn resolve_tag_slug(\n    client: &PolymarketGammaHttpClient,\n    slug: &str,\n) -> anyhow::Result<u64> {\n    let tags = client.request_tags().await?;\n    let tag_id = tags\n        .iter()\n        .find(|t| t.slug.as_deref() == Some(slug))\n        .map(|t| t.id.as_str())\n        .ok_or_else(|| anyhow::anyhow!(\"Tag slug '{slug}' not found\"))?;\n    tag_id\n        .parse::<u64>()\n        .map_err(|e| anyhow::anyhow!(\"Tag slug '{slug}' returned invalid ID '{tag_id}': {e}\"))\n}\n\n#[async_trait(?Send)]\nimpl InstrumentProvider for PolymarketInstrumentProvider {\n    fn store(&self) -> &InstrumentStore {\n        &self.store\n    }\n\n    fn store_mut(&mut self) -> &mut InstrumentStore {\n        &mut self.store\n    }\n\n    async fn load_all(&mut self, filters: Option<&HashMap<String, String>>) -> anyhow::Result<()> {\n        let instruments = self.fetch_bulk_instruments(filters).await?;\n        self.replace_instruments(instruments);","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/providers.rs#L1025-L1061","documentation":"resolve_tag_slug fetches all Gamma tags via client.request_tags(), looks up the tag whose slug matches, and errors with \"Tag slug '{slug}' not found\" when no tag in the returned list has that slug. This happens before any numeric tag ID can be used in Gamma event queries.","triggerScenarios":"Calling resolve_tag_slug with a slug string that does not exist in Polymarket's Gamma tag list at request time (or an async task within any query path that resolves a tag filter).","commonSituations":"Typo in slug (case-sensitive match: 'Politics' vs 'politics'), slug renamed/retired by Polymarket, network returning a partial tag list, or stale config referencing an old slug.","solutions":["Verify the exact slug against Polymarket's Gamma tags endpoint (slugs are matched exactly via t.slug == Some(slug))","Refresh the tag list — request_tags() is fetched live each call, so a newly added slug works immediately","Update the config to use the numeric tag ID directly instead of slug resolution where possible","Check network/proxy responses; a truncated tag list can hide a valid slug"],"exampleFix":"// before\nlet tag_id = resolve_tag_slug(&client, \"Politics\").await?;\n// after\nlet tag_id = resolve_tag_slug(&client, \"politics\").await?;","handlingStrategy":"try-catch","validationCode":"// Rust: verify slug exists against a cached tag list before querying\nfn slug_known(tags: &[GammaTag], slug: &str) -> bool {\n    tags.iter().any(|t| t.slug.as_deref() == Some(slug))\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch resolve_tag_slug(&client, slug).await {\n    Ok(id) => id,\n    Err(e) if e.to_string().contains(\"not found\") => {\n        eprintln!(\"unknown tag slug '{slug}'; check https://gamma-api.polymarket.com/tags\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep slugs lowercase-kebab as returned by the Gamma API; they are matched exactly","Cache and periodically refresh the tag list to detect renamed slugs","Prefer numeric tag IDs in long-lived configs to avoid slug churn"],"tags":["not-found","polymarket","gamma-api","tags","async"],"backgroundTag":"resource-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}