DIYgod/RSSHub · error · Error
Tag not found
Error message
Tag not found
What it means
8kcosplay tag lookup queries /wp-json/wp/v2/tags?slug=… and throws a plain `Error('Tag not found')` when WP returns no matches. Result is cached under '8kcosplay:tag:<slug>'.
Source
Thrown at lib/routes/8kcos/utils.ts:55
}
return {
id: categoryInfo.id,
title: categoryInfo.yoast_head_json.title,
description: categoryInfo.description,
link: categoryInfo.link,
};
});
export const getTagInfo = (tag: string) =>
cache.tryGet(`8kcosplay:tag:${tag}`, async () => {
const data = await ofetch('https://www.8kcosplay.com/wp-json/wp/v2/tags', {
query: {
slug: tag,
},
});
const tagInfo = data[0];
if (!tagInfo) {
throw new Error('Tag not found');
}
return {
id: tagInfo.id,
title: tagInfo.yoast_head_json.title,
description: tagInfo.description,
};
});
View on GitHub (pinned to bed535e087)
Solutions
- Verify the slug at https://www.8kcosplay.com/wp-json/wp/v2/tags?slug=<your-slug>.
- Invalidate the cache key '8kcosplay:tag:<slug>'.
- Use the exact lowercase, dash-joined slug from the WP term.
Example fix
// before tag: 'Long Skirt' // spaces, wrong form // after tag: 'long-skirt'
Defensive patterns
Strategy: try-catch
Validate before calling
function looksLikeWpTagSlug(s) {
return typeof s === 'string' && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(s);
} Type guard
function isWpTagSlug(s): s is string {
return typeof s === 'string' && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(s);
} Try / catch
try {
return await getTagInfo(tag);
} catch (e) {
if (e instanceof Error && /Tag not found/.test(e.message)) {
return null;
}
throw e;
} Prevention
- Multi-word tags use a dash joiner in WP slugs.
- Invalidate '8kcosplay:tag:<slug>' after a correction.
- Match on the message text — the error class is plain Error, not InvalidParameterError.
When it happens
Trigger: Calling the 8kcos tag feed with a slug that does not exist on 8kcosplay.com — typo, renamed tag, or using an ID instead of the slug.
Common situations: Tag renamed in WP admin; cache replaying a previous bad lookup; multi-word tag slug misunderstood (WP joins with '-').
Related errors
- Category not found
- Unknown asset type: ${content.assetType} in ${item.link}
- Unknown placeholder type: ${placeholder?.type} in ${link}
- 日报数据不存在或为空
- Empty content: ${articleUrl}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/9808a89490c668a9.
Report an issue: GitHub.