DIYgod/RSSHub · error · InvalidParameterError

No topic named ${topic}

Error message

No topic named ${topic}

What it means

Thrown by the UTAG (utgd.net) topic route when the `topic` path parameter does not match any `title` in the `/api/v2/topic/` listing response. The route fetches the full topic list from the API and searches for an exact title match. This is an `InvalidParameterError` (HTTP 400). The default topic is `在线阅读专栏`.

Source

Thrown at lib/routes/utgd/topic.ts:48

    description: `| 在线阅读专栏 | 卡片笔记专题 |
| ------------ | ------------ |

更多专栏请见 [专题广场](https://utgd.net/topic)`,
};

async function handler(ctx) {
    const topic = ctx.req.param('topic') ?? '在线阅读专栏';
    const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 20;

    const currentUrl = `${rootUrl}/topic`;
    const topicUrl = `${apiRootUrl}/api/v2/topic/`;

    let response = await ofetch(topicUrl);

    const topicItem = response.find((i) => i.title === topic);

    if (!topicItem) {
        throw new InvalidParameterError(`No topic named ${topic}`);
    }

    const apiUrl = `${rootUrl}/api/v2/topic/${topicItem.id}/article/`;

    response = await ofetch(apiUrl);

    const list = parseResult(response.results, limit);

    const items = await Promise.all(list.map((item) => parseArticle(item)));

    return {
        title: `UNTAG - ${topicItem.title}`,
        link: currentUrl,
        item: items,
        description: topicItem.summary,
    };
}

View on GitHub (pinned to bed535e087)

Solutions

  1. Browse https://utgd.net/topic to find the exact current topic title and use it verbatim in the URL.
  2. Omit the topic parameter to use the default `在线阅读专栏`.
  3. URL-encode the topic name if it contains special characters.

Example fix

// before
GET /utgd/topic/old-topic-name
// after
GET /utgd/topic/在线阅读专栏
Defensive patterns

Strategy: validation

Validate before calling

// Before calling the handler, verify the topic exists
// (This requires an API call, so it's done inside the handler itself)
const response = await ofetch(topicUrl);
const topicItem = response.find((i) => i.title === topic);
if (!topicItem) {
    throw new InvalidParameterError(
        `No topic named '${topic}'. Available topics: ${response.map((i) => i.title).join(', ')}`
    );
}

Try / catch

try {
    const feed = await fetch('/utgd/topic/' + encodeURIComponent(topic));
} catch (e) {
    if (e.name === 'InvalidParameterError') {
        // topic doesn't exist; fall back to default or prompt user
    }
}

Prevention

When it happens

Trigger: A request to `/utgd/topic/:topic` where `:topic` is a string that does not exactly match (case-sensitive, full-string) any topic title returned by `https://utgd.net/api/v2/topic/`. For example, a topic name that was renamed, deleted, or that contains trailing whitespace.

Common situations: The topic was renamed or removed from the platform since the user's subscription URL was created; the user passed a partial or approximate topic name; or whitespace/encoding differences between the URL and the API title.

Related errors


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