jackwener/OpenCLI · warning · CommandExecutionError

JD item detail images were not found

Error message

JD item detail images were not found

What it means

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.

Source

Thrown at clis/jd/item.js:694

        const result = { title, price, shop, specs, mainImages, detailImages, totalImages: new Set(srcs).size, pageState };
        if (!pageState.isProductPage) {
          result.error = pageState.looksBlocked
            ? 'JD page is blocked by login/security verification'
            : 'JD product page was not loaded';
          result.pageState = pageState;
        }
        return result;
      })()
    `);
        if (data?.error) {
            if (data?.pageState?.looksBlocked) {
                throw new AuthRequiredError('item.jd.com', data.error);
            }
            throw new CommandExecutionError(data.error);
        }
        if (maxImages > 0 && data?.pageState?.isProductPage && (!Array.isArray(data.detailImages) || data.detailImages.length === 0)) {
            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.');
        }
        return [data];
    },
});
export const __test__ = {
    normalizePositiveInt,
    normalizeJdSkuInput,
    normalizeJdImageUrl,
    normalizeJdImageSize,
    isJdMainImage,
    collectImageUrlsFrom,
    collectImageUrlsFromText,
    collectImageUrlsFromFramesAndScripts,
    collectImageUrlsFromPayload,
    collectImageUrlsFromPageDataObjects,
    collectImageUrlsFromNetworkResources,
    collectImageUrlsFromWareGraphicText,
    collectImageUrlsFromWareGraphicResources,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Increase the wait/timeout or scroll the page so lazy images render before extraction
  2. Retry — transient rendering timing often explains empty results
  3. Check the product in a browser to confirm it actually has detail images
  4. Update opencli in case JD changed its image data structures

Example fix

// before
const item = await jdItem(sku, { maxImages: 5 });
// after
try {
  const item = await jdItem(sku, { maxImages: 5 });
} catch (e) {
  if (/detail images were not found/.test(e.message)) {
    await sleep(3000); // allow lazy images, then retry
    const item = await jdItem(sku, { maxImages: 5 });
  }
}
Defensive patterns

Strategy: retry

Validate before calling

// confirm the product page is expected to have images before demanding them
const item = await jdItem(sku, { maxImages: 0 }); // probe without images
if (item?.pageState?.isProductPage) {
  return jdItem(sku, { maxImages: 5 }); // then fetch with images
}

Type guard

function isMissingImagesError(e) {
  return e?.code === 'COMMAND_EXEC' && /detail images were not found/.test(e.message);
}

Try / catch

try {
  return await jdItem(sku, { maxImages: 5 });
} catch (e) {
  if (isMissingImagesError(e)) {
    await sleep(4000); // let lazy images render
    return jdItem(sku, { maxImages: 5 });
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/f720ce0183886d50. Report an issue: GitHub.