jackwener/OpenCLI · error · CommandExecutionError

coupang search filtered navigation failed: ${error?.message

Error message

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

What it means

CommandExecutionError wrapping failure of page.goto() to the filtered, paginated URL during a Coupang search with --filter and --page > 1. It indicates navigation to the constructed filteredUrl was rejected.

Source

Thrown at clis/coupang/search.js:448

        });
        if (filter) {
            const filterResult = await page.evaluate(buildApplyFilterEvaluate(filter)).catch((error) => {
                throw new CommandExecutionError(`coupang search filter evaluation failed: ${error?.message || error}`);
            });
            if (!filterResult?.ok) {
                throw new EmptyResultError('coupang search', `Filter "${filter}" was not available on the current page; try without --filter or wait for Coupang to render the filter bar.`);
            }
            await page.wait(3).catch((error) => {
                throw new CommandExecutionError(`coupang search wait failed: ${error?.message || error}`);
            });
            if (pageNumber > 1) {
                const locationInfo = await page.evaluate(buildCurrentLocationEvaluate()).catch((error) => {
                    throw new CommandExecutionError(`coupang search location evaluation failed: ${error?.message || error}`);
                });
                const filteredUrl = new URL(locationInfo?.href || url);
                filteredUrl.searchParams.set('page', String(pageNumber));
                await page.goto(filteredUrl.toString()).catch((error) => {
                    throw new CommandExecutionError(`coupang search filtered navigation failed: ${error?.message || error}`);
                });
            }
        }
        await page.autoScroll({ times: filter ? 3 : 2, delayMs: 1500 }).catch((error) => {
            throw new CommandExecutionError(`coupang search scroll failed: ${error?.message || error}`);
        });
        const raw = await page.evaluate(buildSearchEvaluate(query, limit, pageNumber)).catch((error) => {
            throw new CommandExecutionError(`coupang search extraction failed: ${error?.message || error}`);
        });
        const loginHints = raw?.loginHints ?? {};
        const items = Array.isArray(raw?.items) ? raw.items : [];
        const domItems = Array.isArray(raw?.domItems) ? raw.domItems : [];
        const normalizedBase = sanitizeSearchItems(items.map((item, index) => normalizeSearchItem(item, index)), limit);
        const normalizedDom = sanitizeSearchItems(domItems.map((item, index) => normalizeSearchItem(item, index)), Math.max(limit * 6, 60));
        const normalized = filter
            ? sanitizeSearchItems(normalizedDom, limit)
            : mergeSearchItems(normalizedBase, normalizedDom, limit);
        if (!normalized.length) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry — transient network failures often resolve
  2. Drop --filter and paginate normally
  3. Check the locationInfo.href value being turned into filteredUrl for malformed URLs
  4. Increase navigation timeout or verify network/proxy settings

Example fix

// before
await page.goto(filteredUrl.toString());
// after
await page.goto(filteredUrl.toString()).catch(() => page.goto(url));
Defensive patterns

Strategy: retry

Validate before calling

if (pageNumber > 1 && isHttpUrl(locationHref)) { /* safe to goto */ }

Type guard

function isHttpUrl(u) { try { const url = new URL(u); return url.protocol === 'https:' || url.protocol === 'http:'; } catch { return false; } }

Try / catch

try { await search({ filter, page }); } catch (e) { if (/filtered navigation failed/.test(e.message)) { await delay(2000); return retry(); } throw e; }

Prevention

When it happens

Trigger: `coupang search <query> --filter "..." --page 2+` where page.goto(filteredUrl) fails — invalid URL built from locationInfo.href, network error, ERR_ABORTED from redirect, or blocked navigation.

Common situations: Coupang rejecting deep-links with filter params; flaky network/DNS; navigation interrupted by an on-page redirect; locationInfo.href being a javascript: or about: URL.

Related errors


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