{"record":{"id":"ac05f1858a6af2b5","repo":"DIYgod/RSSHub","slug":"invalid-search-keyword","errorCode":null,"errorMessage":"Invalid search keyword","messagePattern":"Invalid search keyword","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/skeb/search.ts","lineNumber":32,"sourceCode":"        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n        nsfw: true,\n    },\n    name: 'Search Results',\n    maintainers: ['SnowAgar25'],\n    handler,\n    description: 'Get the search results for works on Skeb',\n};\n\nasync function handler(ctx): Promise<Data> {\n    const keyword = ctx.req.param('keyword');\n\n    if (!keyword) {\n        throw new InvalidParameterError('Invalid search keyword');\n    }\n\n    const url = 'https://hb1jt3kre9-dsn.algolia.net/1/indexes/*/queries';\n\n    const items = await cache.tryGet(`skeb:search:${keyword}`, async () => {\n        const data = await ofetch(url, {\n            method: 'POST',\n            headers: {\n                'x-algolia-application-id': 'HB1JT3KRE9',\n                'x-algolia-api-key': '9a4ce7d609e71bf29e977925e4c6740c',\n            },\n            body: {\n                requests: [\n                    {\n                        indexName: 'User',\n                        query: keyword,\n                        params: 'hitsPerPage=40',\n                        filters: 'genres:art OR genres:comic OR genres:voice OR genres:novel OR genres:video OR genres:music OR genres:correction',","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/skeb/search.ts#L14-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide a non-empty keyword in the URL path: /skeb/search/<your-keyword>.","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).","If integrating programmatically, validate the keyword is non-empty before constructing the RSSHub URL."],"exampleFix":"// before\nGET /skeb/search/\n\n// after\nGET /skeb/search/初音ミク","handlingStrategy":"validation","validationCode":"const keyword = ctx.req.param('keyword');\nif (!keyword || keyword.trim().length === 0) {\n    throw new InvalidParameterError('Invalid search keyword');\n}","typeGuard":"function isValidKeyword(kw: string | undefined): kw is string {\n    return typeof kw === 'string' && kw.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always validate user-supplied path parameters before using them in API calls.","Use Hono validator middleware to enforce non-empty string parameters at the route level.","Return a helpful error message listing valid example keywords."],"tags":["validation","user-input","skeb","search"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}