mvanhorn/last30days-skill · error · ValueError
Polymarket item has no event id or slug
Error message
Polymarket item has no event id or slug
What it means
ValueError raised in Polymarket refetch when the item provides neither a derivable event id nor a slug to query - there is no way to locate the event on the Gamma API at all. This is a hard data-quality failure distinct from the slug-without-id case (error 81), which deliberately fails closed for identity reasons.
Source
Thrown at skills/last30days/scripts/lib/polymarket.py:959
payload = http.request(
"GET", f"{GAMMA_EVENTS_URL}/{quote(event_id)}", timeout=10, retries=2,
)
elif slug_match:
if not expected_id:
# No event id anywhere: slug equality alone cannot verify event
# identity, so fail closed (unsupported) instead of re-deriving a
# verdict from whatever event currently owns the slug.
raise ValueError(
"Polymarket item carries no event id; slug equality alone "
"cannot verify event identity"
)
requested_slug = slug_match.group(1)
payload = http.request(
"GET", GAMMA_EVENTS_URL, params={"slug": requested_slug},
timeout=10, retries=2,
)
else:
raise ValueError("Polymarket item has no event id or slug")
requested_slug = slug_match.group(1) if slug_match else None
def _matches_identity(entry: dict) -> bool:
if str(entry.get("slug") or "").strip() != requested_slug:
return False
if expected_id and str(entry.get("id") or "").strip() != expected_id:
return False
return True
def _pick_event(events: list) -> Any:
candidates = [entry for entry in events if isinstance(entry, dict)]
if requested_slug is None:
return candidates[0] if candidates else None
# Verify identity: Gamma slug queries can return multiple or loosely
# matched events, and verifying a claim against another market's
# prices would fabricate current/stale verdicts.
for entry in candidates:View on GitHub (pinned to c7460f6114)
Solutions
- Validate that item.url matches a polymarket.com/event/... pattern before calling refetch_datum
- Re-ingest the item through the search pipeline to rebuild a well-formed URL and metadata
- Catch ValueError and drop/quarantine the malformed item instead of re-fetching
Example fix
# before
datum = refetch_datum(item, "Yes") # item.url is ''
# after
import re
if not re.search(r"polymarket\.com/event/", item.url or ""):
skip_item(item)
else:
datum = refetch_datum(item, "Yes") Defensive patterns
Strategy: validation
Validate before calling
import re
def has_polymarket_locator(item) -> bool:
url = getattr(item, "url", "") or ""
return bool(re.search(r"polymarket\.com/event/([\w-]+)", url)) or bool(
getattr(item, "id", None) and re.fullmatch(r"\d+", str(item.id))
) Try / catch
try:
datum = refetch_datum(item, key)
except ValueError as e:
if "no event id or slug" in str(e):
quarantine(item) # malformed locator; re-ingest needed
raise Prevention
- Validate item.url matches the /event/ pattern before scheduling re-verification
- Rebuild items through search_polymarket rather than hand-constructing them
- Quarantine items with empty URLs at ingest
When it happens
Trigger: refetch_datum receives an item whose url does not match the event slug regex (or is empty) and from which no numeric event id could be extracted. Both the event_id and slug_match branches are skipped, falling into the final else raise.
Common situations: Corrupted or truncated URLs in persisted items; items built from non-event Polymarket pages (markets, leaderboards) routed into the event refetch path; URL parsing changes after a Polymarket site redesign.
Related errors
- Polymarket item carries no event id; slug equality alone can
- unknown audience register {name!r}; choose one of: {choices}
- StockTwits item has no symbol
- Unknown search source in {flag_name}: {source}
- {flag_name} requires at least one source.
AI-assisted analysis of mvanhorn/last30days-skill@c7460f6114 (2026-08-15).
Data as JSON: /api/errors/22e2ef49dd78c84b.
Report an issue: GitHub.