jackwener/OpenCLI · error · CommandExecutionError
data.error
Error message
data.error
What it means
The jd item command throws CommandExecutionError(data.error) when the scrape returns an error without the page looking blocked — i.e. a genuine scrape failure relayed from the in-page script (page didn't load, SKU invalid, DOM structure unexpected). Unlike error 2086, pageState.looksBlocked is false, so it's not classified as auth/block.
Source
Thrown at clis/jd/item.js:691
const mainImages = extractMainImages(maxImg);
const detailImages = await extractDetailImagesFromPage(maxImg, ${JSON.stringify(sku)});
const specs = extractSpecs();
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,View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the SKU/URL is a valid, live JD product
- Retry the command — transient load failures are common
- Open the item URL in a normal browser to confirm it renders
- Update opencli if JD changed its page structure
Example fix
// before
const item = await jdItem(maybeBadSku);
// after
if (!/^\d+$/.test(sku)) throw new Error('invalid JD sku');
try {
const item = await jdItem(sku);
} catch (e) {
if (e.code === 'COMMAND_EXEC') { /* handle scrape failure */ }
} Defensive patterns
Strategy: validation
Validate before calling
if (!/^\d{1,12}$/.test(String(sku))) {
throw new Error(`Invalid JD SKU: ${sku}`);
}
// optionally pre-check the item exists before scraping Type guard
function isScrapeError(e) {
return e?.code === 'COMMAND_EXEC' && e?.message && !/detail images/.test(e.message);
} Try / catch
try {
return await jdItem(sku);
} catch (e) {
if (isScrapeError(e)) {
console.error(`JD item scrape failed for ${sku}: ${e.message}`);
return null; // skip bad SKUs in batch jobs
}
throw e;
} Prevention
- Validate SKU format before calling jd item
- Check SKUs are live products (removed items fail to scrape)
- Retry transient load failures once before giving up
- Keep opencli updated for JD markup changes
When it happens
Trigger: `jd item <sku>` where the evaluate script sets data.error because the product page failed to load, the SKU doesn't exist or was removed, or expected product markup was missing while the page otherwise looks normal.
Common situations: Invalid/deleted JD SKU passed by the caller; network hiccup loading item.jd.com; JD page redesign breaking selectors without a block page; page timed out mid-load.
Related errors
- Failed to upload image to ChatGPT: ${err instanceof Error ?
- Failed to upload image to ChatGPT
- Failed to send image prompt to ChatGPT
- Failed to upload file to ChatGPT project knowledge
- Failed to send message to ChatGPT
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/08f01d58092f9191.
Report an issue: GitHub.