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
- Open the /cw/{creator} page and inspect the og:image meta to see whether the creator ID is still embedded in a different pattern.
- Update the regex (line 126) to match the current og:image URL shape, or fall back to parsing __NEXT_DATA__ even for /cw/ pages.
- If og:image is absent, use another field that carries the campaign ID (e.g. a link rel=canonical or an embedded JSON blob).
- 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
- Add a fallback extraction path (e.g. __NEXT_DATA__) so a regex change does not break /cw/ pages.
- Unit-test the og:image regex against captured real og:image URLs (snapshot).
- Log the og:image URL when extraction fails to detect upstream format drift.
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
- JavaScript file not found.
- Failed to retrieve JSON beatmap info from osu! website
- Creator not found
- Cannot find the script with data-iso-key="_0"
- Key not found.
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/ef8b0b50b6bb6938.
Report an issue: GitHub.