DIYgod/RSSHub · error · Error

Series not found

Error message

Series not found

What it means

Plain Error thrown by the Polymarket series handler when the Gamma API returns an empty array for a series query by slug (limit 1). It fires only in the slug-specific branch; an absent slug lists all series instead. Indicates the slug matches no Polymarket series.

Source

Thrown at lib/routes/polymarket/series.ts:52

    url: 'polymarket.com',
    maintainers: ['heqi201255'],
    handler,
};

async function handler(ctx) {
    const slug = ctx.req.param('slug');

    if (slug) {
        // Get specific series by slug
        const data = await ofetch<Series[]>(`${GAMMA_API}/series`, {
            query: {
                slug,
                limit: 1,
            },
        });

        if (!data.length) {
            throw new Error('Series not found');
        }

        const series = data[0];
        const events = series.events || [];

        const items = events.map((event: Event) => ({
            title: event.title,
            description: formatEventDescription(event),
            link: `https://polymarket.com/event/${event.slug}`,
            pubDate: event.startDate ? parseDate(event.startDate) : undefined,
            category: event.tags?.map((t) => t.label).filter(Boolean) as string[],
        }));

        return {
            title: `Polymarket Series - ${series.title}`,
            link: `https://polymarket.com/series/${series.slug}`,
            item: items,
        };

View on GitHub (pinned to bed535e087)

Solutions

  1. Verify the slug at https://polymarket.com/series/{slug}.
  2. Use a known series slug like nfl, nba, or mlb, or omit the slug to list all series.
  3. Ensure you are passing a series slug, not an individual event slug.
  4. Trim whitespace and remove any trailing slash.
Defensive patterns

Strategy: validation

Validate before calling

function isValidPolymarketSlug(slug: string): boolean {
  return typeof slug === 'string' && slug.length > 0 && /^[a-z0-9-]+$/.test(slug);
}
if (slug && !isValidPolymarketSlug(slug)) {
  // reject early
}

Type guard

const isNonEmptySeriesArray = (d: unknown): d is Series[] =>
  Array.isArray(d) && d.length > 0;

Try / catch

try {
  const data = await ofetch<Series[]>(`${GAMMA_API}/series`, { query: { slug, limit: 1 } });
  if (!data.length) throw new Error('Series not found');
} catch (e) {
  if (e instanceof Error && e.message === 'Series not found') {
    // slug invalid: suggest listing all series (omit slug)
  }
}

Prevention

When it happens

Trigger: Passing a series slug that does not exist (e.g. /polymarket/series/xyz); slug renamed; sport/league slug spelled wrong (nfl/nba/mlb style).

Common situations: Slug typo; copied an event slug instead of a series slug; series discontinued; trailing whitespace.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/da08af03ad9af2ca. Report an issue: GitHub.