{"record":{"id":"8bcbb3f32078a919","repo":"DIYgod/RSSHub","slug":"unknown-type-item-type-8bcbb3","errorCode":null,"errorMessage":"Unknown type: ${item.type}","messagePattern":"Unknown type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/routes/zhihu/zhuanlan.ts","lineNumber":118,"sourceCode":"                link = item.url;\n                author = item.author.name;\n                pubDate = parseDate(item.created * 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        return {\n            title,\n            link,\n            description,\n            pubDate,\n            author,\n        };\n    });\n\n    return {\n        description,\n        item,\n        title: `知乎专栏-${title}`,\n        link: url,\n    };\n}\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/zhihu/zhuanlan.ts#L100-L136","documentation":"The official-endpoint counterpart of error 672: the `default` arm of the item-type switch in `zhihu/zhuanlan.ts`. It handles the known `item.type` values (including `zvideo`) and throws for anything else, reporting the type. A single unhandled item aborts the whole zhuanlan feed.","triggerScenarios":"The official Zhihu column/zhuanlan API returns an item whose `type` is not in the handled set — Zhihu added a new content kind surfaced in a column, or renamed a type string.","commonSituations":"Zhihu ships a new content type inside zhuanlan feeds; a column mixes `article` with an unhandled kind; a type-string rename. The throw fails the entire feed rather than just the unsupported entry.","solutions":["Add a `case` for the reported `item.type` mapping it to the standard feed fields (title/link/description/author/pubDate).","Make `default` skip the unknown item instead of throwing so the rest of the column renders.","Mirror any new case into the xhu `zhuanlan.ts` route (error 672) to keep both in sync."],"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', 'zvideo']); // extend with full known set\nfunction filterZhuanlanItems(items) {\n    return items.filter((item) => HANDLED_ZHUANLAN_TYPES.has(item.type));\n}","typeGuard":"type HandledZhuanlanType = 'article' | 'zvideo';\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 items to known types before the switch so an unknown entry is skipped instead of aborting the feed.","Sync new cases into the xhu zhuanlan.ts route.","Log unknown types to catch Zhihu API additions promptly."],"tags":["zhihu","zhuanlan","content-parsing","switch-enum","api-change"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}