mvanhorn/last30days-skill · error · ValueError
Polymarket item carries no event id; slug equality alone can
Error message
Polymarket item carries no event id; slug equality alone cannot verify event identity
What it means
Raised during Polymarket datum re-verification when the item's URL matches a slug pattern but the item carries no event id anywhere. Because a slug can be reused by a different event over time, slug equality alone cannot prove the refreshed event is the same one originally cited, so the library fails closed with ValueError instead of returning a possibly-wrong verdict.
Source
Thrown at skills/last30days/scripts/lib/polymarket.py:949
# On the slug fallback, a slug can be re-used by a re-created event. When
# the cached item still carries the original Gamma event id (numeric; the
# synthetic PM<N> parse fallback carries no identity), the response id
# must match it too, or the verdict would come from another market.
expected_id = (
cached_item_id
if not event_id and re.fullmatch(r"\d+", cached_item_id)
else ""
)
if event_id:
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 FalseView on GitHub (pinned to c7460f6114)
Solutions
- Ensure items persisted for Polymarket carry the Gamma numeric event id (item.metadata/event id) at ingest time
- If the event id is genuinely unavailable, refresh via the original search flow instead of refetch_datum so identity is re-established
- Catch ValueError here and mark the datum 'unverified' rather than retrying - retrying cannot fix missing identity data
Example fix
# before
url = f"https://polymarket.com/event/{slug}" # id never stored
# after
metadata = {"event_id": event["id"], "slug": slug} # persist id at ingest
url = f"https://polymarket.com/event/{slug}" Defensive patterns
Strategy: validation
Validate before calling
def can_verify_polymarket_event(item) -> bool:
has_id = bool(getattr(item, "id", "") and re.fullmatch(r"\d+", str(item.id)))
has_slug = bool(re.search(r"polymarket\.com/event/([\w-]+)", getattr(item, "url", "") or ""))
return has_id or (has_slug and bool(item.metadata.get("event_id"))) Try / catch
try:
datum = refetch_datum(item, key)
except ValueError as e:
if "slug equality alone" in str(e):
mark_unverifiable(item) # identity data missing; do not retry
raise Prevention
- Persist the Gamma numeric event id in item.metadata at ingest time
- Treat slug-only items as unverifiable by design - never 'fix' by trusting slug equality
- Keep the fail-closed semantics: unverified is a valid state, not a bug
When it happens
Trigger: refetch_datum is called on a Polymarket item whose URL is a slug-style link (e.g. polymarket.com/event/some-slug) but whose cached item id is not purely numeric (so no event id can be derived) and no expected id is available from metadata. The slug_match branch is taken with expected_id falsy, hitting the explicit raise.
Common situations: Items persisted from an older schema that did not store the Gamma event id; hand-constructed items with only a URL; upstream Gamma data where the id field was stripped; migrating stored items between versions of the ingest pipeline.
Related errors
- Polymarket item has no event id or slug
- Nominations bundle {path} contains no readable nominations (
- Polymarket event was not found
- Polymarket event is closed, unavailable, or malformed
- Polymarket datum {datum_key!r} was not found
AI-assisted analysis of mvanhorn/last30days-skill@c7460f6114 (2026-08-15).
Data as JSON: /api/errors/105ed8bfb26ac592.
Report an issue: GitHub.