DIYgod/RSSHub · warning · Error

Invalid group: "${group}". Valid values: ALL, notices, event

Error message

Invalid group: "${group}". Valid values: ALL, notices, events, news

What it means

Thrown by the Hypergryph Endfield (明日方舟:终末地) news route when the `:group` path parameter is not `ALL`, `notices`, `events`, or `news`. The handler normalizes the value to lowercase and checks against a `Set` of valid tab names, plus the special case `all`. The error message includes the invalid value and lists valid options. The default is `ALL` when the parameter is omitted, so omitting it is safe.

Source

Thrown at lib/routes/hypergryph/endfield/news.ts:55

            source: ['endfield.hypergryph.com/news'],
        },
    ],
    name: '明日方舟:终末地 - 游戏公告与新闻',
    maintainers: ['E-larex'],
    handler,
    url: 'endfield.hypergryph.com/news',
    description: `| 全部 | 公告    | 活动   | 新闻 |
| ---- | ------- | ------ | ---- |
| ALL  | notices | events | news |`,
};

async function handler(ctx) {
    const { group = 'ALL' } = ctx.req.param();

    const normalizedGroup = group.toLowerCase();
    const validTabs = new Set(['notices', 'events', 'news']);
    if (normalizedGroup !== 'all' && !validTabs.has(normalizedGroup)) {
        throw new Error(`Invalid group: "${group}". Valid values: ALL, notices, events, news`);
    }

    const apiUrl = 'https://web-news.hypergryph.com/api/bulletin?lang=zh-cn&code=endfield_web&page=1&pageSize=10' + (normalizedGroup === 'all' ? '' : `&tabs[]=${normalizedGroup}`);

    const bulletinList: NewsItem[] = await cache.tryGet(
        `hypergryph:endfield:news:${normalizedGroup}`,
        async () => {
            const response = await ofetch(apiUrl);
            return response.data.list as NewsItem[];
        },
        config.cache.routeExpire,
        false
    );

    const list = parseList(bulletinList);

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

View on GitHub (pinned to bed535e087)

Solutions

  1. Use `ALL`, `notices`, `events`, or `news` — or omit the parameter (defaults to `ALL`).
  2. As a maintainer: switch to `InvalidParameterError` for HTTP 400 semantics.

Example fix

// before (broken)
// GET /hypergryph/endfield/news/notice

// after (correct)
// GET /hypergryph/endfield/news/notices
Defensive patterns

Strategy: validation

Validate before calling

const VALID_GROUPS = ['all', 'notices', 'events', 'news'];
function isValidGroup(group: string): boolean {
    return VALID_GROUPS.includes(group.toLowerCase());
}

Type guard

function isValidEndfieldGroup(group: string): group is 'ALL' | 'notices' | 'events' | 'news' | 'all' {
    const normalized = group.toLowerCase();
    return normalized === 'all' || new Set(['notices', 'events', 'news']).has(normalized);
}

Prevention

When it happens

Trigger: Requesting `/hypergryph/endfield/news/<group>` where `<group>` is not one of the four valid values. The validation is case-insensitive (lowercased first), so `NOTICES` would pass but `notice` (missing the 's') would fail.

Common situations: Typo in the group name (e.g. `notice` instead of `notices`, `event` instead of `events`, `new` instead of `news`), or using a singular form.

Related errors


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