{"record":{"id":"c2c968b3f3ad2c91","repo":"DIYgod/RSSHub","slug":"html-c2c968","errorCode":null,"errorMessage":"HTML 缓存中无章节!","messagePattern":"HTML 缓存中无章节!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/comic-walker/manga.ts","lineNumber":92,"sourceCode":"        const coverImage = work.bookCover || work.thumbnail;\n\n        const firstEpisodes = getEpisodes(data.firstEpisodes);\n        const latestEpisodes = getEpisodes(data.latestEpisodes);\n        const extraEpisodes = getEpisodes(data.episodes);\n\n        const seenCodes = new Set<string>();\n        const allChapters = [...firstEpisodes, ...latestEpisodes, ...extraEpisodes]\n            .filter((ep) => {\n                if (ep?.code && !seenCodes.has(ep.code)) {\n                    seenCodes.add(ep.code);\n                    return true;\n                }\n                return false;\n            })\n            .toSorted((a: any, b: any) => (b.internal?.episodeNo || 0) - (a.internal?.episodeNo || 0));\n\n        if (allChapters.length === 0) {\n            throw new Error('HTML 缓存中无章节!');\n        }\n\n        const items = allChapters.map((chapter: any) => {\n            const epType = chapter.type === 'normal' ? '正篇' : '特别篇/PR';\n            const isReadStatus = chapter.isActive ? '' : ' (未解锁/仍需等待)';\n            const fullTitle = `${chapter.title}${chapter.subTitle ? ` - ${chapter.subTitle}` : ''}${isReadStatus}`;\n            const thumb = chapter.originalThumbnail || chapter.thumbnail;\n\n            const currentPubDate = chapter.updateDate ? parseDate(chapter.updateDate) : undefined;\n\n            return {\n                title: fullTitle,\n                link: `${baseUrl}/detail/${id}/episodes/${chapter.code}`,\n                description: `\n                    ${thumb ? `<img src=\"${thumb}\" style=\"max-width: 100%;\"><br>` : ''}\n                `,\n                guid: `Kadocomi-manga-${chapter.code}`,\n                category: epType,","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/comic-walker/manga.ts#L74-L110","documentation":"After combining and deduplicating all episode lists (firstEpisodes, latestEpisodes, extraEpisodes) from the comic-walker work data, zero chapters remain. Every episode was either missing a valid 'code' field or was a duplicate, leaving an empty array. The route cannot produce a feed with no items.","triggerScenarios":"The filter chain removes all episodes because: (1) the three episode arrays were all empty in the API response, (2) every episode lacked an ep.code property (filtered out by the `if (ep?.code && ...)` guard), or (3) all episodes shared the same code and were deduplicated to one, then the filter's return logic still failed to retain them.","commonSituations":"The manga is upcoming and has no published episodes yet; the API response changed episode field names (e.g., 'code' renamed to 'episodeCode'); episodes exist in the raw data but get filtered out because the code field is null for preview/locked content; the manga is region-locked and the API returns metadata without episodes.","solutions":["Log the raw data.firstEpisodes, data.latestEpisodes, and data.episodes arrays to check if they contain data.","Inspect individual episode objects to verify the 'code' field still exists and is populated.","If episodes exist but lack 'code', check if a different unique identifier field should be used for deduplication.","Consider returning an empty feed with allowEmpty: true instead of throwing, if zero episodes is a legitimate state."],"exampleFix":"// before\nif (allChapters.length === 0) {\n    throw new Error('HTML 缓存中无章节!');\n}\n\n// after — log raw counts for diagnosis\nif (allChapters.length === 0) {\n    const raw = firstEpisodes.length + latestEpisodes.length + extraEpisodes.length;\n    throw new Error(`No chapters after dedup. Raw episode count: ${raw}. Check if 'code' field exists on episodes.`);\n}","handlingStrategy":"validation","validationCode":"const rawEpisodeCount = firstEpisodes.length + latestEpisodes.length + extraEpisodes.length;\nif (rawEpisodeCount === 0) {\n    throw new Error('No episodes found in any episode list — manga may have no published content');\n}\n// Then check after dedup\nif (allChapters.length === 0) {\n    throw new Error(`All ${rawEpisodeCount} episodes filtered out — check 'code' field presence`);\n}","typeGuard":"function episodeHasCode(ep: any): ep is { code: string; title: string } {\n    return ep != null && typeof ep.code === 'string' && ep.code.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Log raw episode counts before and after dedup to distinguish 'no data' from 'all filtered out'.","Verify the 'code' field is still present on episode objects — API field renames are the most common cause.","Consider returning an allowEmpty feed if zero episodes is a legitimate state for upcoming manga."],"tags":["scraping","comic-walker","parsing","episodes","data-validation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}