{"record":{"id":"3b17424dc74c28a4","repo":"DIYgod/RSSHub","slug":"unknown-type-item-type-3b1742","errorCode":null,"errorMessage":"Unknown type: ${item.type}","messagePattern":"Unknown type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/routes/zhihu/xhu/zhuanlan.ts","lineNumber":105,"sourceCode":"                    author = item.question.author ? item.question.author.name : '';\n                    link = `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}`;\n                    pubDate = parseDate(item.created_time * 1000);\n\n                    break;\n\n                case 'zvideo':\n                    // 如果类型是zvideo，id即为视频地址参数\n                    title = item.title;\n                    link = `https://www.zhihu.com/zvideo/${item.id}`;\n                    author = item.author.name;\n                    pubDate = parseDate(item.created_at * 1000);\n                    // 判断是否存在视频简介\n                    description = item.description ? `${item.description} <br> <br> <a href=\"${link}\">视频内容请跳转至原页面观看</a>` : `<a href=\"${link}\">视频内容请跳转至原页面观看</a>`;\n\n                    break;\n\n                default:\n                    throw new Error(`Unknown type: ${item.type}`);\n            }\n\n            return {\n                title,\n                description,\n                author,\n                pubDate,\n                guid: link,\n                link,\n            };\n        }),\n    };\n}\n","sourceCodeStart":87,"sourceCodeEnd":119,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/zhihu/xhu/zhuanlan.ts#L87-L119","documentation":"Thrown by the `default` arm of the item-type switch in the Zhihu xhu zhuanlan route. The switch handles known `item.type` values including `zvideo`; any item whose type is not modeled triggers this throw, echoing the type. Like the sibling routes, one unhandled item fails the whole feed.","triggerScenarios":"The xhu zhuanlan/column endpoint returns an item whose `type` is outside the handled set — e.g. a new content type the mirror passes through, or a mixed feed where the column surfaces a type the route never encoded.","commonSituations":"Zhihu or the xhu mirror introduces a new content type surfaced inside a column feed; a type string is renamed; the column aggregates `article` + an unhandled kind. The throw aborts the entire column feed.","solutions":["Add a `case` for the reported `item.type` that produces a feed entry (reuse the title/link/description mapping pattern).","Make `default` skip the unknown item (filter it out) instead of throwing so the rest of the column still renders.","Keep this type list in sync with the official `zhuanlan.ts` route (error 673)."],"exampleFix":"// before\ndefault:\n    throw new Error(`Unknown type: ${item.type}`);\n// after — skip unknown items\ndefault:\n    return null;","handlingStrategy":"type-guard","validationCode":"const HANDLED_ZHUANLAN_TYPES = new Set(['article', /* ...existing types... */ 'zvideo']);\nfunction filterZhuanlanItems(items) {\n    return items.filter((item) => HANDLED_ZHUANLAN_TYPES.has(item.type));\n}","typeGuard":"type HandledZhuanlanType = 'article' | 'zvideo'; // extend with actual known set\nfunction isHandledZhuanlanType(item: { type: string }): item is { type: HandledZhuanlanType } {\n    return new Set<HandledZhuanlanType>(['article','zvideo']).has(item.type as HandledZhuanlanType);\n}","tryCatchPattern":"const items = rawItems.filter(isHandledZhuanlanType).map(/* existing mapping */);","preventionTips":["Filter the items array by known types before the switch so unknown entries are dropped, not fatal.","Mirror any new case into the official zhuanlan.ts route to keep both consistent.","Log unknown types to surface mirror API changes."],"tags":["zhihu","xhu","zhuanlan","content-parsing","switch-enum"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}