jackwener/OpenCLI · error · CommandExecutionError

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

Error message

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

What it means

CommandExecutionError wrapping failure of page.autoScroll(...) used to trigger Coupang lazy-loaded search results before extraction. Scrolling is required for Coupang to render the full result set.

Source

Thrown at clis/coupang/search.js:453

            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) {
            if (loginHints.hasLoginLink && !loginHints.hasMyCoupang) {
                throw new AuthRequiredError('coupang.com', 'Please log into Coupang in Chrome and retry.');
            }
            throw new EmptyResultError('coupang search', `No products matched "${query}". Try a more specific keyword or remove --filter.`);
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the search
  2. Remove --filter (changes scroll count) and retry to isolate
  3. Check for login/captcha interstitial replacing results
  4. Increase delayMs or reduce scroll times if the page is unstable

Example fix

// before
await page.autoScroll({ times: 2, delayMs: 1500 });
// after
await page.autoScroll({ times: 2, delayMs: 1500 }).catch(() => {});
Defensive patterns

Strategy: try-catch

Try / catch

try { await search(q); } catch (e) { if (/scroll failed/.test(e.message)) { /* continue: extraction may still find above-the-fold items */ } else throw e; }

Prevention

When it happens

Trigger: `coupang search <query>` where the autoScroll helper rejects — page closed mid-scroll, navigation triggered by the scroll, or the scroll helper's internal evaluate throws.

Common situations: Very long pages hitting memory limits; infinite-scroll that navigates; Coupang anti-bot interstitials replacing the results page mid-scroll.

Related errors


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