DIYgod/RSSHub · error · Error

Unable to extract creator ID

Error message

Unable to extract creator ID

What it means

Thrown by the Patreon creator extractor when the page is a /cw/ (campaigns) URL and the og:image URL does not contain a 'card-teaser-image/creator/{digits}' segment from which the numeric creator ID is regex-captured. Without that ID, the /api/campaigns/{id} lookup cannot run, so the route aborts.

Source

Thrown at lib/routes/patreon/feed.tsx:134

    const link = `${baseUrl}/${creator}`;

    const creatorData = (await cache.tryGet(`patreon:creator:${creator}`, async () => {
        const response = await ofetch(link);

        const $ = load(response);

        const ogUrl = $('meta[property="og:url"]').attr('content');
        if (ogUrl?.startsWith(`${baseUrl}/cw/`)) {
            const ogImage = $('meta[property="og:image"]').attr('content');
            const creatorId = decodeURIComponent(ogImage || '').match(/card-teaser-image\/creator\/(\d+)/)?.[1];
            if (creatorId) {
                const creator = await ofetch(`${baseUrl}/api/campaigns/${creatorId}`);
                return {
                    id: creatorId,
                    attributes: creator.data.attributes,
                };
            }
            throw new Error('Unable to extract creator ID');
        }

        const nextData = JSON.parse($('#__NEXT_DATA__').text());
        const bootstrapEnvelope = nextData.props.pageProps.bootstrapEnvelope;

        return {
            id: bootstrapEnvelope.pageBootstrap.campaign.data.id,
            attributes: bootstrapEnvelope.pageBootstrap.campaign.data.attributes,
        };
    })) as CreatorData;

    if (!creatorData.id) {
        throw new Error('Creator not found');
    }

    let headers = {};
    if (config.patreon?.sessionId) {
        headers = {

View on GitHub (pinned to bed535e087)

Solutions

  1. Open the /cw/{creator} page and inspect the og:image meta to see whether the creator ID is still embedded in a different pattern.
  2. Update the regex (line 126) to match the current og:image URL shape, or fall back to parsing __NEXT_DATA__ even for /cw/ pages.
  3. If og:image is absent, use another field that carries the campaign ID (e.g. a link rel=canonical or an embedded JSON blob).
  4. File/track an upstream-format-change issue and pin the route until fixed.

Example fix

// before
const creatorId = decodeURIComponent(ogImage || '').match(/card-teaser-image\/creator\/(\d+)/)?.[1];
if (creatorId) {
    /* ... fetch /api/campaigns/{id} ... */
}
throw new Error('Unable to extract creator ID');

// after — fall back to __NEXT_DATA__ campaign id when og:image lacks the id
let creatorId = decodeURIComponent(ogImage || '').match(/card-teaser-image\/creator\/(\d+)/)?.[1];
if (!creatorId) {
    const nextData = JSON.parse($('#__NEXT_DATA__').text());
    creatorId = nextData.props?.pageProps?.bootstrapEnvelope?.pageBootstrap?.campaign?.data?.id;
}
if (!creatorId) {
    throw new Error('Unable to extract creator ID');
}
Defensive patterns

Strategy: fallback

Validate before calling

// Detect the /cw/ shape and whether og:image carries the id before extracting.
function ogImageHasCreatorId(ogImage: string | undefined): boolean {
    return Boolean(ogImage && /card-teaser-image\/creator\/\d+/.test(decodeURIComponent(ogImage)));
}

Type guard

const isCwUrl = (ogUrl: string | undefined, baseUrl: string): boolean =>
    Boolean(ogUrl) && ogUrl!.startsWith(`${baseUrl}/cw/`);

Try / catch

try {
    creatorData = await extractCreator(creator);
} catch (e) {
    if (e instanceof Error && /Unable to extract creator ID/.test(e.message)) {
        // fall back to the generic __NEXT_DATA__ path even for /cw/ pages
        creatorData = await extractCreatorViaNextData(creator);
    } else throw e;
}

Prevention

When it happens

Trigger: og:url starts with 'https://www.patreon.com/cw/' (the campaigns landing path) AND the og:image meta either is missing or its URL no longer matches /card-teaser-image\/creator\/(\d+)/. The regex returns undefined, creatorId is falsy, and the throw fires.

Common situations: Patreon changed the og:image URL format for /cw/ pages (different CDN path, no creator ID embedded); the creator has no card-teaser image so og:image is empty; Patreon A/B-tested a different OG tag set on campaigns pages.

Related errors


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