{"record":{"id":"2b2194b42eaad304","repo":"jackwener/OpenCLI","slug":"coupang-product-navigation-failed-error-messag","errorCode":null,"errorMessage":"coupang product navigation failed: ${error?.message || error}","messagePattern":"coupang product navigation failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coupang/product.js","lineNumber":219,"sourceCode":"        { name: 'url', required: false, help: 'Canonical Coupang product URL (alternative to --product-id)' },\n    ],\n    columns: [\n        '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.`);","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coupang/product.js#L201-L237","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the interpolated inner error message to identify the root cause (timeout vs DNS vs refused).","Verify Chrome is running and connected to the opencli daemon; reconnect the extension if needed.","Check network connectivity and that https://www.coupang.com loads in a normal browser from this machine.","Re-run with a corrected/canonical product URL (e.g. https://www.coupang.com/vp/products/<productId>).","Retry later if Coupang is temporarily blocking or throttling your IP."],"exampleFix":"// before\nawait page.goto(rawUrl);\n// after\nconst targetUrl = canonicalizeProductUrl(kwargs.url, productId);\nawait page.goto(targetUrl || canonicalizeProductUrl('', productId)).catch((error) => {\n    throw new CommandExecutionError(`coupang product navigation failed: ${error?.message || error}`);\n});","handlingStrategy":"try-catch","validationCode":"// before calling the command\nconst url = new URL(productUrl);\nif (url.hostname !== 'www.coupang.com' && url.hostname !== 'coupang.com') throw new Error('not a coupang URL');\nif (!/^\\/vp\\/products\\/\\d+/.test(url.pathname) && !/^\\d+$/.test(productId)) throw new Error('no valid product id');","typeGuard":"function isCoupangProductUrl(u) { try { const url = new URL(u); return url.hostname.endsWith('coupang.com') && /\\/vp\\/products\\/\\d+/.test(url.pathname); } catch { return false; } }","tryCatchPattern":"try {\n  const rows = await run('coupang product', { url: productUrl });\n} catch (err) {\n  if (err?.code === 'COMMAND_EXEC' && /navigation failed/.test(err.message)) {\n    // check network / Chrome connection, maybe retry once\n  } else throw err;\n}","preventionTips":["Pre-validate the product URL/id format before invoking the command.","Check internet connectivity and that Chrome is connected before batch runs.","Prefer canonical https://www.coupang.com/vp/products/<id> URLs.","Add a small retry with backoff for transient navigation failures."],"tags":["network","navigation","browser","coupang"],"backgroundTag":"page-navigation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}