{"record":{"id":"55b7045784dd75bf","repo":"DIYgod/RSSHub","slug":"invalid-category-category-55b704","errorCode":null,"errorMessage":"Invalid Category: ${category}","messagePattern":"Invalid Category: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/i-cable/news.tsx","lineNumber":49,"sourceCode":"        },\n    ],\n    name: '新聞',\n    maintainers: ['quiniapiezoelectricity'],\n    handler,\n    url: 'www.i-cable.com/',\n    description: `::: tip\n分類只可用分類名稱，如：新聞資訊 / 港聞\n:::`,\n};\n\nasync function handler(ctx) {\n    const category = ctx.req.param('category') ?? '新聞資訊';\n    const limit = ctx.req.query('limit') ?? 20;\n    const root = 'https://www.i-cable.com/wp-json/wp/v2';\n\n    const response = await cache.tryGet(`${root}/categories?slug=${category}`, async () => await got(`${root}/categories?slug=${category}`), config.cache.routeExpire, false);\n    if (response.data.length < 1) {\n        throw new InvalidParameterError(`Invalid Category: ${category}`);\n    }\n    const metadata = response.data[0];\n\n    const list = await got(`${root}/posts?_embed=1&categories=${metadata.id}&per_page=${limit}`);\n    const items = list.data.map((item) => {\n        const description = renderToString(\n            <>\n                {item._embedded['wp:featuredmedia']?.length\n                    ? item._embedded['wp:featuredmedia'].map((media) => (\n                          <figure>\n                              <img src={media.source_url} />\n                          </figure>\n                      ))\n                    : null}\n                {item.content.rendered ? raw(item.content.rendered) : null}\n            </>\n        );\n        return {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/i-cable/news.tsx#L31-L67","documentation":"The i-cable route looks up a WordPress category by slug via the `/categories?slug=<category>` endpoint. If the response array is empty (no matching category) it throws InvalidParameterError echoing the supplied category. Categories are matched by their Chinese slug name (e.g. 新聞資訊, 港聞).","triggerScenarios":"`/i-cable/news/<category>` where <category> is not an existing WP category slug — English names, typos, or renamed categories all produce an empty result.","commonSituations":"Supplying an English category name instead of the Chinese slug; a typo in the Chinese name; the publisher renamed the category.","solutions":["Use the exact Chinese category name as shown in the route's description table (新聞資訊, 港聞, ...).","Verify the slug by browsing i-cable.com and copying the category label.","Default to 新聞資訊 by omitting the segment."],"exampleFix":"// before\n//   /i-cable/news/news\n// after\n//   /i-cable/news/新聞資訊","handlingStrategy":"validation","validationCode":"async function categorySlugExists(category: string): Promise<boolean> {\n  const { data } = await got(`https://www.i-cable.com/wp-json/wp/v2/categories?slug=${encodeURIComponent(category)}`);\n  return data.length > 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the Chinese slug against the live WP REST API before subscribing.","URL-encode the category — Chinese characters in the path need proper encoding.","Default to 新聞資訊 when the segment is omitted."],"tags":["validation","i18n","cms"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}