{"record":{"id":"84f240658fa7d95b","repo":"DIYgod/RSSHub","slug":"unknown-type-item-type","errorCode":null,"errorMessage":"Unknown type: ${item.type}","messagePattern":"Unknown type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"error","filePath":"lib/routes-deprecated/aiyanxishe/home.js","lineNumber":101,"sourceCode":"\n            switch (item.type) {\n                case 'blog':\n                    itemUrl += '&type=null';\n\n                    break;\n\n                case 'article':\n                    itemUrl = `https://api.yanxishe.com/api/stranslate/article/${item.id}?token=null&type=null`;\n\n                    break;\n\n                case 'paper':\n                    itemUrl = `https://api.yanxishe.com/api/spaper/detail?token=null&id=${item.id}`;\n\n                    break;\n\n                default:\n                    throw new Error(`Unknown type: ${item.type}`);\n            }\n\n            const cache = await ctx.cache.get(itemUrl);\n            if (cache) {\n                return JSON.parse(cache);\n            }\n\n            const response = await got({\n                method: 'get',\n                url: itemUrl,\n            });\n\n            const result = ProcessFeed(item.type, response.data.data, item.id);\n\n            const single = {\n                title: item.zh_title,\n                description: result.description,\n                pubDate: new Date(Number.parseFloat(item.published_time + '000')).toUTCString(),","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/aiyanxishe/home.js#L83-L119","documentation":"Thrown by the aiyanxishe home route when an item returned by the upstream yanxishe API has a `type` field that is neither 'article' nor 'paper'. The switch maps those two types to detail URLs; any new type the API starts returning falls through to the default and aborts the whole feed.","triggerScenarios":"The yanxishe API introduces a new content type (e.g. 'video', 'column', 'report') and returns it in the list response.","commonSituations":"Upstream API schema drift; a previously-unused type now appearing in responses; A/B test variant returning tagged items.","solutions":["Inspect the failing API response to identify the new type value.","Add a case in the switch mapping the new type to its detail URL, or skip unknown types with `continue` instead of throwing.","Report the upstream change to RSSHub maintainers with a sample payload."],"exampleFix":"// before\ndefault:\n    throw new Error(`Unknown type: ${item.type}`);\n// after — skip items we cannot handle instead of failing the feed\ndefault:\n    continue;","handlingStrategy":"fallback","validationCode":"const KNOWN_TYPES = new Set(['article', 'paper']);\nconst items = (await got(url)).data;\nconst handled = items.filter((i) => KNOWN_TYPES.has(i.type));","typeGuard":"const isSupportedType = (t: unknown): t is 'article' | 'paper' =>\n  t === 'article' || t === 'paper';","tryCatchPattern":"// Route-level: degrade instead of failing the whole feed.\nconst detail = isSupportedType(item.type) ? await fetchDetail(item) : null;","preventionTips":["Default to skipping unknown types rather than throwing.","Log unknown types so upstream drift is visible.","Pin a schema test against a recorded API response."],"tags":["scraping","routes","upstream","api-drift"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}