jackwener/OpenCLI · error · CommandExecutionError
coupang product extraction failed: ${error?.message || error
Error message
coupang product extraction failed: ${error?.message || error} What it means
Wraps a failure of page.evaluate(buildProductDetailEvaluate(productId)) — the in-page DOM extraction script for the Coupang product detail. If the evaluation script throws or the browser command fails, it is rethrown as a CommandExecutionError with this message.
Source
Thrown at clis/coupang/product.js:225
],
func: async (page, kwargs) => {
const rawProductId = kwargs['product-id'];
if (!rawProductId && !kwargs.url) {
throw new ArgumentError('Either --product-id or --url is required');
}
const productId = rawProductId
? requireProductIdArg(rawProductId, 'product-id')
: requireProductIdArg(kwargs.url, '--url');
const targetUrl = canonicalizeProductUrl(kwargs.url, productId);
const finalUrl = targetUrl || canonicalizeProductUrl('', productId);
await page.goto(finalUrl).catch((error) => {
throw new CommandExecutionError(`coupang product navigation failed: ${error?.message || error}`);
});
await page.wait(2).catch((error) => {
throw new CommandExecutionError(`coupang product wait failed: ${error?.message || error}`);
});
const result = await page.evaluate(buildProductDetailEvaluate(productId)).catch((error) => {
throw new CommandExecutionError(`coupang product extraction failed: ${error?.message || error}`);
});
const loginHints = result?.loginHints ?? {};
if (loginHints.hasLoginLink && !loginHints.hasMyCoupang) {
throw new AuthRequiredError('coupang.com', 'Please log into Coupang in Chrome and retry.');
}
if (result?.reason === 'PRODUCT_MISMATCH') {
const actualProductId = normalizeProductId(result?.currentProductId || '');
const observed = actualProductId ? `got ${actualProductId}` : 'no product id observed';
throw new EmptyResultError('coupang product', `Product page redirected: expected ${productId}, ${observed} (item may be sold out or unavailable in your region)`);
}
if (!result?.ok || !result?.data) {
throw new EmptyResultError('coupang product', `No product data extracted from ${finalUrl}. The page may have failed to render or this product is restricted.`);
}
const actualProductId = normalizeProductId(result?.currentProductId || result.data.product_id || productId);
const data = result.data;
return [{
product_id: actualProductId,
title: data.title || null,View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command after confirming the product page loads and renders in a normal Chrome window.
- Complete any captcha/login interstitial in the connected Chrome profile, then retry.
- Increase the browser command timeout if evaluate is timing out.
- Update the CLI if Coupang changed its DOM (check for a newer version fixing extraction selectors).
Defensive patterns
Strategy: retry
Validate before calling
// sanity-check the target page exists before extraction
const res = await fetch(productUrl, { method: 'HEAD' });
if (!res.ok) throw new Error(`product URL returned HTTP ${res.status}`); Try / catch
try {
return await run('coupang product', { url });
} catch (err) {
if (err?.code === 'COMMAND_EXEC' && /extraction failed/.test(err.message)) {
// page likely didn't render or a captcha appeared; retry after a pause
await sleep(3000);
return await run('coupang product', { url });
}
throw err;
} Prevention
- Complete any captcha/login interstitial in the connected Chrome profile first.
- Ensure the page fully renders in a normal browser before automating it.
- Keep the CLI updated for Coupang DOM changes.
- Use one retry with delay rather than hammering the page.
When it happens
Trigger: `opencli coupang product` where the in-page evaluate fails: page did not render (still on error/captcha page so expected DOM missing and script throws), page closed or navigated mid-evaluate, script execution blocked by CSP, or browser command timeout.
Common situations: Coupang showing a bot-detection/captcha interstitial instead of the product page; very slow render causing evaluate on an incomplete document; extension disconnected mid-command; Coupang DOM changes crashing a selector access inside the evaluate script.
Related errors
- coupang search filter evaluation failed: ${error?.message ||
- coupang add-to-cart evaluation failed: ${error?.message || e
- coupang product navigation failed: ${error?.message || error
- coupang product wait failed: ${error?.message || error}
- `Failed to read facebook feed: ${err instanceof Error ? err.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1d024b9cf525ad26.
Report an issue: GitHub.