DIYgod/RSSHub · error · Error

Invalid Locals content route option. Supported filters are `

Error message

Invalid Locals content route option. Supported filters are `plus` and `nonplus`, and supported content types are `video`, `live`, `audio`, `podcast`, `article`, `document`, and `pdf`.

What it means

Thrown by `parseOptions` (lib/routes/locals/feed.ts:341) when one of the two path options (`option1`/`option2`) is neither a recognized content filter (`plus`, `nonplus`) nor a recognized content type (`video`, `live`, `audio`, `podcast`, `article`, `document`, `pdf`, plus aliases `live_stream`/`podcasts`). This guards the route's optional path segments before any network call.

Source

Thrown at lib/routes/locals/feed.ts:341

        description: renderDescription(image, post.text),
        image,
        itunes_item_image: image,
        link: post.share_url,
        pubDate: post.published ? parseDate(post.published) : post.post_date ? parseDate(post.post_date) : undefined,
        title: getTitle(post),
    };
}

function parseOptions(option1: string | undefined, option2: string | undefined) {
    const values = [option1, option2].filter(Boolean) as string[];
    const hasFilter = (value: string): value is ContentFilter => Object.hasOwn(contentFilterMap, value);
    const hasContentType = (value: string): value is ContentType => Object.hasOwn(contentTypeMap, value);
    const filter = values.find((value) => hasFilter(value));
    const contentType = values.find((value) => hasContentType(value));
    const unknown = values.find((value) => !hasFilter(value) && !hasContentType(value));

    if (unknown) {
        throw new Error('Invalid Locals content route option. Supported filters are `plus` and `nonplus`, and supported content types are `video`, `live`, `audio`, `podcast`, `article`, `document`, and `pdf`.');
    }

    return {
        contentType: contentType ? contentTypeMap[contentType] : undefined,
        filter,
    };
}

async function requestServerFunction<T>(session: string, id: string, key: string, args: unknown[]) {
    const response = await ofetch.raw(`${rootUrl}/_server`, {
        body: createRequestBody(args),
        headers: {
            'Content-Type': 'application/json',
            ...getRequestHeaders(session),
            'X-Server-Id': id,
            'X-Server-Instance': key,
        },
        method: 'POST',

View on GitHub (pinned to bed535e087)

Solutions

  1. Use only documented values: filters `plus`/`nonplus`; types `video`, `live`, `audio`, `podcast`, `article`, `document`, `pdf`.
  2. Drop the option entirely if you want the unfiltered feed.
  3. If a new content type is needed, add it to `contentTypeMap` in lib/routes/locals/feed.ts:15.

Example fix

// before: GET /locals/mycommunity/articles
// after:  GET /locals/mycommunity/article
Defensive patterns

Strategy: validation

Validate before calling

const FILTERS = ['plus', 'nonplus'];
const TYPES = ['video', 'live', 'audio', 'podcast', 'article', 'document', 'pdf', 'live_stream', 'podcasts'];
function isValidLocalsOption(v: string): boolean {
    return FILTERS.includes(v) || TYPES.includes(v);
}
for (const opt of [option1, option2].filter(Boolean)) {
    if (!isValidLocalsOption(opt)) throw new TypeError(`Unknown Locals option '${opt}'`);
}

Type guard

function isContentFilter(v: string): v is 'plus' | 'nonplus' { return v === 'plus' || v === 'nonplus'; }
function isContentType(v: string): boolean { return TYPES.includes(v); }

Try / catch

try {
    parseOptions(option1, option2);
} catch (e) {
    if (e instanceof Error && /Invalid Locals content route option/.test(e.message)) {
        return { error: 'Use a filter (plus|nonplus) or a content type (video|live|audio|podcast|article|document|pdf)' };
    }
    throw e;
}

Prevention

When it happens

Trigger: Requesting `/locals/<community>/<bad>` or `/locals/<community>/<filter>/<badType>` with a typo or unsupported value — e.g. `/locals/foo/articles`, `/locals/foo/free`, `/locals/foo/images`.

Common situations: Users assuming plural/alternate names not in the alias map; passing a filter where a type is expected and vice versa; passing three segments.

Related errors


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