{"record":{"id":"f720ce0183886d50","repo":"jackwener/OpenCLI","slug":"jd-item-detail-images-were-not-found","errorCode":null,"errorMessage":"JD item detail images were not found","messagePattern":"JD item detail images were not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"warning","filePath":"clis/jd/item.js","lineNumber":694,"sourceCode":"\n        const result = { title, price, shop, specs, mainImages, detailImages, totalImages: new Set(srcs).size, pageState };\n        if (!pageState.isProductPage) {\n          result.error = pageState.looksBlocked\n            ? 'JD page is blocked by login/security verification'\n            : 'JD product page was not loaded';\n          result.pageState = pageState;\n        }\n        return result;\n      })()\n    `);\n        if (data?.error) {\n            if (data?.pageState?.looksBlocked) {\n                throw new AuthRequiredError('item.jd.com', data.error);\n            }\n            throw new CommandExecutionError(data.error);\n        }\n        if (maxImages > 0 && data?.pageState?.isProductPage && (!Array.isArray(data.detailImages) || data.detailImages.length === 0)) {\n            throw new CommandExecutionError('JD item detail images were not found', 'The product page loaded, but no detail images were detected from DOM, scripts, frames, page data, or WareGraphic fallback.');\n        }\n        return [data];\n    },\n});\nexport const __test__ = {\n    normalizePositiveInt,\n    normalizeJdSkuInput,\n    normalizeJdImageUrl,\n    normalizeJdImageSize,\n    isJdMainImage,\n    collectImageUrlsFrom,\n    collectImageUrlsFromText,\n    collectImageUrlsFromFramesAndScripts,\n    collectImageUrlsFromPayload,\n    collectImageUrlsFromPageDataObjects,\n    collectImageUrlsFromNetworkResources,\n    collectImageUrlsFromWareGraphicText,\n    collectImageUrlsFromWareGraphicResources,","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jd/item.js#L676-L712","documentation":"The jd item command throws CommandExecutionError('JD item detail images were not found', hint) when detail images were requested (maxImages > 0), the page IS a product page, but no detail images could be extracted from DOM, scripts, frames, page data, or the WareGraphic fallback. It prevents silently returning an item with an empty image list.","triggerScenarios":"Calling `jd item <sku> --images N` (maxImages>0) on a real product page where extraction found zero detailImages — lazy-loaded images not yet rendered, images served via endpoints the script didn't reach, or JD changed image markup/data fields.","commonSituations":"JD switched to a new lazy-load/CDN scheme; slow network prevented lazy images from rendering before extraction; detail images loaded only on scroll; product uses a rare template with no WareGraphic data.","solutions":["Increase the wait/timeout or scroll the page so lazy images render before extraction","Retry — transient rendering timing often explains empty results","Check the product in a browser to confirm it actually has detail images","Update opencli in case JD changed its image data structures"],"exampleFix":"// before\nconst item = await jdItem(sku, { maxImages: 5 });\n// after\ntry {\n  const item = await jdItem(sku, { maxImages: 5 });\n} catch (e) {\n  if (/detail images were not found/.test(e.message)) {\n    await sleep(3000); // allow lazy images, then retry\n    const item = await jdItem(sku, { maxImages: 5 });\n  }\n}","handlingStrategy":"retry","validationCode":"// confirm the product page is expected to have images before demanding them\nconst item = await jdItem(sku, { maxImages: 0 }); // probe without images\nif (item?.pageState?.isProductPage) {\n  return jdItem(sku, { maxImages: 5 }); // then fetch with images\n}","typeGuard":"function isMissingImagesError(e) {\n  return e?.code === 'COMMAND_EXEC' && /detail images were not found/.test(e.message);\n}","tryCatchPattern":"try {\n  return await jdItem(sku, { maxImages: 5 });\n} catch (e) {\n  if (isMissingImagesError(e)) {\n    await sleep(4000); // let lazy images render\n    return jdItem(sku, { maxImages: 5 });\n  }\n  throw e;\n}","preventionTips":["Allow extra settle time/scrolling for lazy-loaded detail images","Only request maxImages on pages confirmed to be product pages","Retry once before treating empty images as permanent","Update opencli if JD changes image extraction surfaces"],"tags":["jd","scraping","images","empty-result"],"backgroundTag":"page-scrape-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}