{"record":{"id":"657428338d8a2da0","repo":"jackwener/OpenCLI","slug":"coupang-product-wait-failed-error-message-e","errorCode":null,"errorMessage":"coupang product wait failed: ${error?.message || error}","messagePattern":"coupang product wait failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coupang/product.js","lineNumber":222,"sourceCode":"        'product_id', 'title', 'price', 'original_price', 'discount_rate',\n        'rating', 'review_count', 'seller', 'brand', 'rocket',\n        'delivery_promise', 'image_url', 'url',\n    ],\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;","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coupang/product.js#L204-L240","documentation":"Wraps a failure of page.wait(2) after navigating to the Coupang product page. The command waits 2 seconds for the page to render before extraction; if the wait call itself throws (browser command timeout, page/context closed), it is rethrown as a CommandExecutionError with this message.","triggerScenarios":"`opencli coupang product` where the post-navigation page.wait(2) browser command fails: global browser command timeout (OPENCLI_BROWSER_COMMAND_TIMEOUT) too small, page closed/crashed after goto, or the browser connection dropped between goto and wait.","commonSituations":"OPENCLI_BROWSER_COMMAND_TIMEOUT set below 2 seconds; flaky Chrome extension connection; page crashed due to heavy content; user navigating away or closing the tab during the run.","solutions":["Increase the browser command timeout (--timeout or OPENCLI_BROWSER_COMMAND_TIMEOUT).","Check that the Chrome extension/daemon connection is alive and reconnect.","Retry the command; transient connection drops often resolve on a second run.","If the page keeps crashing, test the product URL in a normal Chrome window."],"exampleFix":"// before\nOPENCLI_BROWSER_COMMAND_TIMEOUT=1 opencli coupang product --url ...\n// after\nOPENCLI_BROWSER_COMMAND_TIMEOUT=30 opencli coupang product --url ...","handlingStrategy":"retry","validationCode":"// ensure timeout headroom before running\nconst t = parseInt(process.env.OPENCLI_BROWSER_COMMAND_TIMEOUT || '30', 10);\nif (t < 10) throw new Error(`OPENCLI_BROWSER_COMMAND_TIMEOUT=${t}s is too small; use >= 10s`);","typeGuard":null,"tryCatchPattern":"try {\n  return await run('coupang product', { url });\n} catch (err) {\n  if (err?.code === 'COMMAND_EXEC' && /wait failed/.test(err.message)) {\n    await sleep(2000);\n    return await run('coupang product', { url }); // retry once\n  }\n  throw err;\n}","preventionTips":["Keep OPENCLI_BROWSER_COMMAND_TIMEOUT comfortably above the 2s wait (e.g. 30s).","Don't close or navigate the Chrome tab while the command runs.","Verify the extension/daemon connection before long batch runs.","Retry once automatically; wait failures are often transient."],"tags":["timeout","browser","coupang","wait"],"backgroundTag":"browser-command-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}