DIYgod/RSSHub · error · Error

Invalid tag slug: ${slug}

Error message

Invalid tag slug: ${slug}

What it means

Thrown by getTags() in the MissKON utils when the WordPress REST API at misskon.com/wp-json/wp/v2/tags?slug=<slug> returns an empty array — meaning no tag with that slug exists. It is a bare `throw new Error`. getTags is shared by tag-based routes; the slug comes from the :slug path parameter.

Source

Thrown at lib/routes/misskon/utils.ts:32

        $('input').each((_, el) => {
            $(el).replaceWith($(el).attr('value') || '');
        });
        return {
            title: item.title.rendered,
            link: item.link,
            description: $.html(),
            pubDate: timezone(parseDate(item.date_gmt), 0),
            category: item._embedded['wp:term']
                .flat()
                .filter((x) => x.taxonomy === 'post_tag')
                .map((x) => x.name),
        };
    });
};
const getTags = async (slug) => {
    const data = await ofetch(`${ENDPOINT}/tags?slug=${slug}`);
    if (data.length === 0) {
        throw new Error(`Invalid tag slug: ${slug}`);
    }
    return {
        id: data[0].id,
        name: data[0].name,
        link: data[0].link,
        description: data[0].description,
    };
};
export { ENDPOINT, getPosts, getTags };

View on GitHub (pinned to bed535e087)

Solutions

  1. Look up the correct slug on misskon.com: open the tag page and copy the last URL path segment (it is lowercase and hyphenated).
  2. Verify the slug directly: `curl 'https://misskon.com/wp-json/wp/v2/tags?slug=<slug>'` — a non-empty array means the slug is valid.
  3. If maintaining the route, switch the bare Error to a NotFoundError for a cleaner client response.
Defensive patterns

Strategy: validation

Validate before calling

const data = await ofetch(`${ENDPOINT}/tags?slug=${encodeURIComponent(slug)}`);
if (!Array.isArray(data) || data.length === 0) {
    throw new InvalidParameterError(`No MissKON tag with slug '${slug}'. Check the tag page URL for the correct (lowercase) slug.`);
}

Type guard

function isTagArray(data: unknown): data is { id: number; name: string; link: string; description: string }[] {
    return Array.isArray(data) && data.length > 0 && typeof data[0]?.id === 'number';
}

Prevention

When it happens

Trigger: A route calls getTags(slug); the WP tags endpoint responds with [] (HTTP 200 but empty). This happens when the slug is misspelled, the tag was renamed/deleted, or the slug uses a different casing than stored.

Common situations: User copies a tag slug from a URL but it's actually the tag's display name, not its slug; the site renamed the tag; case-sensitivity mismatch (WP slugs are lowercase).

Related errors


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