{"record":{"id":"233dd15466624f9a","repo":"DIYgod/RSSHub","slug":"event-not-found","errorCode":null,"errorMessage":"Event not found","messagePattern":"Event not found","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/polymarket/event.ts","lineNumber":42,"sourceCode":"    radar: [\n        {\n            source: ['polymarket.com/event/:slug'],\n            target: '/event/:slug',\n        },\n    ],\n    name: 'Event',\n    url: 'polymarket.com',\n    maintainers: ['heqi201255'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const slug = ctx.req.param('slug');\n\n    const event = await ofetch<Event>(`${GAMMA_API}/events/slug/${slug}`);\n\n    if (!event) {\n        throw new Error('Event not found');\n    }\n\n    const items = event.markets!.map((market) => ({\n        title: market.question,\n        description: `\n            <p><strong>Odds:</strong> ${formatOddsDisplay(market)}</p>\n            <p><strong>Volume:</strong> $${Number(market.volume || 0).toLocaleString()}</p>\n            ${market.oneDayPriceChange ? `<p><strong>24h Change:</strong> ${(market.oneDayPriceChange * 100).toFixed(1)}%</p>` : ''}\n            ${market.image ? `<img src=\"${market.image}\" alt=\"${market.question}\" style=\"max-width: 100%;\">` : ''}\n        `,\n        link: `https://polymarket.com/event/${event.slug}`,\n        pubDate: market.startDate || event.startDate ? parseDate(market.startDate || event.startDate!) : undefined,\n        category: event.tags?.map((t) => t.label).filter(Boolean) as string[],\n    }));\n\n    return {\n        title: event.title,\n        link: `https://polymarket.com/event/${event.slug}`,","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/polymarket/event.ts#L24-L60","documentation":"Plain Error thrown by the Polymarket event handler when ofetch returns a falsy event body from GAMMA_API /events/slug/{slug}. It guards the case where the Gamma API responds successfully with null/empty for a slug that does not match a known event. (A hard HTTP error from ofetch would already have thrown before this line.)","triggerScenarios":"The slug does not correspond to any Polymarket event; the event was delisted/reslugged; the API returned a 200 with an empty body for a malformed slug.","commonSituations":"Slug typo; outdated slug from an old feed; event merged into a series and slug changed; trailing slash or whitespace in the slug.","solutions":["Open https://polymarket.com/event/{slug} to confirm the event exists and the slug is current.","Copy the slug exactly from the current Polymarket URL path.","Strip whitespace/slashes from the slug before subscribing.","If the event moved into a series, use the /polymarket/series/:slug route instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function isValidPolymarketSlug(slug: string): boolean {\n  return typeof slug === 'string' && slug.length > 0 && /^[a-z0-9-]+$/.test(slug) && !slug.endsWith('/') && !slug.includes(' ');\n}\nif (!isValidPolymarketSlug(slug)) {\n  // reject early\n}","typeGuard":"const isEvent = (e: unknown): e is Event =>\n  typeof e === 'object' && e !== null && typeof (e as any).slug === 'string';","tryCatchPattern":"try {\n  const event = await ofetch<Event>(`${GAMMA_API}/events/slug/${slug}`);\n  if (!event) throw new Error('Event not found');\n} catch (e) {\n  // ofetch throws on HTTP errors; 'Event not found' covers null-body 200s\n  if (e instanceof Error && e.message === 'Event not found') {\n    // slug invalid/delisted: advise checking polymarket.com/event/{slug}\n  }\n}","preventionTips":["Validate the slug format before the fetch.","Confirm the event exists on polymarket.com before subscribing.","Strip trailing slashes/whitespace from user-supplied slugs."],"tags":["polymarket","not-found","api","slug","event"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}