{"record":{"id":"1d024b9cf525ad26","repo":"jackwener/OpenCLI","slug":"coupang-product-extraction-failed-error-messag","errorCode":null,"errorMessage":"coupang product extraction failed: ${error?.message || error}","messagePattern":"coupang product extraction failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coupang/product.js","lineNumber":225,"sourceCode":"    ],\n    func: async (page, kwargs) => {\n        const rawProductId = kwargs['product-id'];\n        if (!rawProductId && !kwargs.url) {\n            throw new ArgumentError('Either --product-id or --url is required');\n        }\n        const productId = rawProductId\n            ? requireProductIdArg(rawProductId, 'product-id')\n            : requireProductIdArg(kwargs.url, '--url');\n        const targetUrl = canonicalizeProductUrl(kwargs.url, productId);\n        const finalUrl = targetUrl || canonicalizeProductUrl('', productId);\n        await page.goto(finalUrl).catch((error) => {\n            throw new CommandExecutionError(`coupang product navigation failed: ${error?.message || error}`);\n        });\n        await page.wait(2).catch((error) => {\n            throw new CommandExecutionError(`coupang product wait failed: ${error?.message || error}`);\n        });\n        const result = await page.evaluate(buildProductDetailEvaluate(productId)).catch((error) => {\n            throw new CommandExecutionError(`coupang product extraction failed: ${error?.message || error}`);\n        });\n        const loginHints = result?.loginHints ?? {};\n        if (loginHints.hasLoginLink && !loginHints.hasMyCoupang) {\n            throw new AuthRequiredError('coupang.com', 'Please log into Coupang in Chrome and retry.');\n        }\n        if (result?.reason === 'PRODUCT_MISMATCH') {\n            const actualProductId = normalizeProductId(result?.currentProductId || '');\n            const observed = actualProductId ? `got ${actualProductId}` : 'no product id observed';\n            throw new EmptyResultError('coupang product', `Product page redirected: expected ${productId}, ${observed} (item may be sold out or unavailable in your region)`);\n        }\n        if (!result?.ok || !result?.data) {\n            throw new EmptyResultError('coupang product', `No product data extracted from ${finalUrl}. The page may have failed to render or this product is restricted.`);\n        }\n        const actualProductId = normalizeProductId(result?.currentProductId || result.data.product_id || productId);\n        const data = result.data;\n        return [{\n                product_id: actualProductId,\n                title: data.title || null,","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coupang/product.js#L207-L243","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// sanity-check the target page exists before extraction\nconst res = await fetch(productUrl, { method: 'HEAD' });\nif (!res.ok) throw new Error(`product URL returned HTTP ${res.status}`);","typeGuard":null,"tryCatchPattern":"try {\n  return await run('coupang product', { url });\n} catch (err) {\n  if (err?.code === 'COMMAND_EXEC' && /extraction failed/.test(err.message)) {\n    // page likely didn't render or a captcha appeared; retry after a pause\n    await sleep(3000);\n    return await run('coupang product', { url });\n  }\n  throw err;\n}","preventionTips":["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."],"tags":["extraction","dom","browser","coupang"],"backgroundTag":"page-evaluate-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}