{"record":{"id":"e9ef304a0b5a7949","repo":"jackwener/OpenCLI","slug":"no-images-found-for-illustration-illustid","errorCode":null,"errorMessage":"No images found for illustration ${illustId}.","messagePattern":"No images found for illustration (.+?)\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/pixiv/download.js","lineNumber":40,"sourceCode":"        { name: 'illust-id', positional: true, required: true, help: 'Illustration ID' },\n        { name: 'output', default: './pixiv-downloads', help: 'Output directory' },\n    ],\n    columns: ['index', 'type', 'status', 'size'],\n    func: async (page, kwargs) => {\n        const illustId = String(kwargs['illust-id'] ?? '');\n        const output = String(kwargs.output ?? './pixiv-downloads');\n        if (!/^\\d+$/.test(illustId)) {\n            throw new CommandExecutionError(`Invalid illustration ID: ${illustId}`);\n        }\n        // pixivFetch handles navigate + error checking; returns the response body directly\n        const pages = await pixivFetch(page, `/ajax/illust/${illustId}/pages`, {\n            notFoundMsg: `Illustration not found: ${illustId}`,\n        });\n        if (!Array.isArray(pages)) {\n            throw new CommandExecutionError('Pixiv pages API returned malformed payload');\n        }\n        if (pages.length === 0) {\n            throw new EmptyResultError('pixiv download', `No images found for illustration ${illustId}.`);\n        }\n        // Extract cookies for authenticated downloads\n        const cookies = formatCookieHeader(await page.getCookies({ domain: 'pixiv.net' }));\n        // Create output directory\n        const outputDir = path.join(output, illustId);\n        fs.mkdirSync(outputDir, { recursive: true });\n        const results = [];\n        for (let i = 0; i < pages.length; i++) {\n            const p = pages[i];\n            const url = p.urls?.original || p.urls?.regular || '';\n            if (!url) {\n                results.push({ index: i + 1, type: 'image', status: 'failed', size: 'No URL' });\n                continue;\n            }\n            try {\n                const ext = path.extname(new URL(url).pathname) || '.jpg';\n                const filename = `${illustId}_p${i}${ext}`;\n                const destPath = path.join(outputDir, filename);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pixiv/download.js#L22-L58","documentation":"An EmptyResultError thrown when the pixiv pages API responded successfully but the returned array contains zero images. The illustration exists (or at least did not 404) but has no downloadable pages.","triggerScenarios":"The illustration is R-18/restricted and the current session cannot see its pages, the work was deleted or made private after the ID was resolved, or pixiv returns an empty pages list for the ID.","commonSituations":"Downloading R-18 content without an authenticated/age-verified cookie session; using a stale ID for a since-deleted artwork; region-restricted works.","solutions":["Log in and export valid pixiv cookies (including age-verification for R-18) and retry","Verify the artwork is still public by opening its pixiv page in a browser","Try a different illustration ID to confirm your session works at all","If R-18, enable the R-18 setting on your pixiv account before exporting cookies"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Verify accessibility before downloading\nconst res = await fetch(`https://www.pixiv.net/artworks/${illustId}`);\nif (!res.ok) throw new Error(`Artwork ${illustId} not publicly accessible`);","typeGuard":null,"tryCatchPattern":"try {\n  await pixivDownload({ illustId });\n} catch (e) {\n  if (e instanceof EmptyResultError || /No images found/.test(e.message)) {\n    console.warn(`Skipping ${illustId}: no visible pages (R-18/deleted/private?)`);\n  } else throw e;\n}","preventionTips":["Use a logged-in, age-verified pixiv session for R-18 works","Check the artwork page in a browser before bulk downloads","Treat EmptyResultError as skippable in bulk scripts","Remove deleted/private IDs from your download list"],"tags":["empty-result","pixiv","content-restricted"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}