jackwener/OpenCLI · error · CommandExecutionError

coupang product wait failed: ${error?.message || error}

Error message

coupang product wait failed: ${error?.message || error}

What it means

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.

Source

Thrown at clis/coupang/product.js:222

        'product_id', 'title', 'price', 'original_price', 'discount_rate',
        'rating', 'review_count', 'seller', 'brand', 'rocket',
        'delivery_promise', 'image_url', 'url',
    ],
    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;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Increase the browser command timeout (--timeout or OPENCLI_BROWSER_COMMAND_TIMEOUT).
  2. Check that the Chrome extension/daemon connection is alive and reconnect.
  3. Retry the command; transient connection drops often resolve on a second run.
  4. If the page keeps crashing, test the product URL in a normal Chrome window.

Example fix

// before
OPENCLI_BROWSER_COMMAND_TIMEOUT=1 opencli coupang product --url ...
// after
OPENCLI_BROWSER_COMMAND_TIMEOUT=30 opencli coupang product --url ...
Defensive patterns

Strategy: retry

Validate before calling

// ensure timeout headroom before running
const t = parseInt(process.env.OPENCLI_BROWSER_COMMAND_TIMEOUT || '30', 10);
if (t < 10) throw new Error(`OPENCLI_BROWSER_COMMAND_TIMEOUT=${t}s is too small; use >= 10s`);

Try / catch

try {
  return await run('coupang product', { url });
} catch (err) {
  if (err?.code === 'COMMAND_EXEC' && /wait failed/.test(err.message)) {
    await sleep(2000);
    return await run('coupang product', { url }); // retry once
  }
  throw err;
}

Prevention

When it happens

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

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

Related errors


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