DIYgod/RSSHub · error · InvalidParameterError

Invalid search keyword

Error message

Invalid search keyword

What it means

Thrown as an InvalidParameterError when the `keyword` path parameter on the Skeb search route (/skeb/search/:keyword) is falsy (undefined, empty string). InvalidParameterError is RSSHub's standard error type for bad user input (HTTP 400 semantics). The route definition requires a non-empty keyword because the Algolia search API call embeds it directly in the POST body query field.

Source

Thrown at lib/routes/skeb/search.ts:32

        requireConfig: false,
        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
        nsfw: true,
    },
    name: 'Search Results',
    maintainers: ['SnowAgar25'],
    handler,
    description: 'Get the search results for works on Skeb',
};

async function handler(ctx): Promise<Data> {
    const keyword = ctx.req.param('keyword');

    if (!keyword) {
        throw new InvalidParameterError('Invalid search keyword');
    }

    const url = 'https://hb1jt3kre9-dsn.algolia.net/1/indexes/*/queries';

    const items = await cache.tryGet(`skeb:search:${keyword}`, async () => {
        const data = await ofetch(url, {
            method: 'POST',
            headers: {
                'x-algolia-application-id': 'HB1JT3KRE9',
                'x-algolia-api-key': '9a4ce7d609e71bf29e977925e4c6740c',
            },
            body: {
                requests: [
                    {
                        indexName: 'User',
                        query: keyword,
                        params: 'hitsPerPage=40',
                        filters: 'genres:art OR genres:comic OR genres:voice OR genres:novel OR genres:video OR genres:music OR genres:correction',

View on GitHub (pinned to bed535e087)

Solutions

  1. Provide a non-empty keyword in the URL path: /skeb/search/<your-keyword>.
  2. URL-encode the keyword properly if it contains special characters or spaces (e.g. /skeb/search/%E5%88%9D%E9%9F%B3%E3%83%9F%E3%82%AF).
  3. If integrating programmatically, validate the keyword is non-empty before constructing the RSSHub URL.

Example fix

// before
GET /skeb/search/

// after
GET /skeb/search/初音ミク
Defensive patterns

Strategy: validation

Validate before calling

const keyword = ctx.req.param('keyword');
if (!keyword || keyword.trim().length === 0) {
    throw new InvalidParameterError('Invalid search keyword');
}

Type guard

function isValidKeyword(kw: string | undefined): kw is string {
    return typeof kw === 'string' && kw.trim().length > 0;
}

Prevention

When it happens

Trigger: A request to /skeb/search/ with no keyword segment, or a URL-encoded empty string. Hono (the web framework) may also pass undefined if the path parameter binding fails to extract a value.

Common situations: User constructs the feed URL manually and omits the keyword; a bookmark or automation tool strips trailing path segments; or the keyword contains only characters that URL-decode to empty.

Related errors


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