jackwener/OpenCLI · error · CommandExecutionError

coupang product navigation failed: ${error?.message || error

Error message

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

What it means

Wraps a failure of page.goto(finalUrl) when the coupang product command navigates to the canonicalized product URL. The library rethrows the underlying navigation error as a CommandExecutionError (exit code 1, code COMMAND_EXEC) so browser/transport failures surface with a command-specific message. The original error message is interpolated into the template.

Source

Thrown at clis/coupang/product.js:219

        { name: 'url', required: false, help: 'Canonical Coupang product URL (alternative to --product-id)' },
    ],
    columns: [
        '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.`);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the interpolated inner error message to identify the root cause (timeout vs DNS vs refused).
  2. Verify Chrome is running and connected to the opencli daemon; reconnect the extension if needed.
  3. Check network connectivity and that https://www.coupang.com loads in a normal browser from this machine.
  4. Re-run with a corrected/canonical product URL (e.g. https://www.coupang.com/vp/products/<productId>).
  5. Retry later if Coupang is temporarily blocking or throttling your IP.

Example fix

// before
await page.goto(rawUrl);
// after
const targetUrl = canonicalizeProductUrl(kwargs.url, productId);
await page.goto(targetUrl || canonicalizeProductUrl('', productId)).catch((error) => {
    throw new CommandExecutionError(`coupang product navigation failed: ${error?.message || error}`);
});
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling the command
const url = new URL(productUrl);
if (url.hostname !== 'www.coupang.com' && url.hostname !== 'coupang.com') throw new Error('not a coupang URL');
if (!/^\/vp\/products\/\d+/.test(url.pathname) && !/^\d+$/.test(productId)) throw new Error('no valid product id');

Type guard

function isCoupangProductUrl(u) { try { const url = new URL(u); return url.hostname.endsWith('coupang.com') && /\/vp\/products\/\d+/.test(url.pathname); } catch { return false; } }

Try / catch

try {
  const rows = await run('coupang product', { url: productUrl });
} catch (err) {
  if (err?.code === 'COMMAND_EXEC' && /navigation failed/.test(err.message)) {
    // check network / Chrome connection, maybe retry once
  } else throw err;
}

Prevention

When it happens

Trigger: Running `opencli coupang product --url <url>` (or with product-id) when page.goto fails: DNS failure, connection refused/reset, Coupang blocking or returning a network error, invalid URL passed to goto, Chrome not reachable, or navigation timeout.

Common situations: Offline machine or no internet access; Coupang rate-limiting or geo-blocking the IP; a malformed product URL that survives canonicalization; Chrome extension/daemon disconnected mid-run; corporate proxy blocking www.coupang.com.

Related errors


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