{"record":{"id":"32f5b3b263212381","repo":"jackwener/OpenCLI","slug":"coupang-search-scroll-failed-error-message","errorCode":null,"errorMessage":"coupang search scroll failed: ${error?.message || error}","messagePattern":"coupang search scroll failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coupang/search.js","lineNumber":453,"sourceCode":"            if (!filterResult?.ok) {\n                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.`);\n            }\n            await page.wait(3).catch((error) => {\n                throw new CommandExecutionError(`coupang search wait failed: ${error?.message || error}`);\n            });\n            if (pageNumber > 1) {\n                const locationInfo = await page.evaluate(buildCurrentLocationEvaluate()).catch((error) => {\n                    throw new CommandExecutionError(`coupang search location evaluation failed: ${error?.message || error}`);\n                });\n                const filteredUrl = new URL(locationInfo?.href || url);\n                filteredUrl.searchParams.set('page', String(pageNumber));\n                await page.goto(filteredUrl.toString()).catch((error) => {\n                    throw new CommandExecutionError(`coupang search filtered navigation failed: ${error?.message || error}`);\n                });\n            }\n        }\n        await page.autoScroll({ times: filter ? 3 : 2, delayMs: 1500 }).catch((error) => {\n            throw new CommandExecutionError(`coupang search scroll failed: ${error?.message || error}`);\n        });\n        const raw = await page.evaluate(buildSearchEvaluate(query, limit, pageNumber)).catch((error) => {\n            throw new CommandExecutionError(`coupang search extraction failed: ${error?.message || error}`);\n        });\n        const loginHints = raw?.loginHints ?? {};\n        const items = Array.isArray(raw?.items) ? raw.items : [];\n        const domItems = Array.isArray(raw?.domItems) ? raw.domItems : [];\n        const normalizedBase = sanitizeSearchItems(items.map((item, index) => normalizeSearchItem(item, index)), limit);\n        const normalizedDom = sanitizeSearchItems(domItems.map((item, index) => normalizeSearchItem(item, index)), Math.max(limit * 6, 60));\n        const normalized = filter\n            ? sanitizeSearchItems(normalizedDom, limit)\n            : mergeSearchItems(normalizedBase, normalizedDom, limit);\n        if (!normalized.length) {\n            if (loginHints.hasLoginLink && !loginHints.hasMyCoupang) {\n                throw new AuthRequiredError('coupang.com', 'Please log into Coupang in Chrome and retry.');\n            }\n            throw new EmptyResultError('coupang search', `No products matched \"${query}\". Try a more specific keyword or remove --filter.`);\n        }","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coupang/search.js#L435-L471","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Very long pages hitting memory limits; infinite-scroll that navigates; Coupang anti-bot interstitials replacing the results page mid-scroll.","solutions":["Retry the search","Remove --filter (changes scroll count) and retry to isolate","Check for login/captcha interstitial replacing results","Increase delayMs or reduce scroll times if the page is unstable"],"exampleFix":"// before\nawait page.autoScroll({ times: 2, delayMs: 1500 });\n// after\nawait page.autoScroll({ times: 2, delayMs: 1500 }).catch(() => {});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await search(q); } catch (e) { if (/scroll failed/.test(e.message)) { /* continue: extraction may still find above-the-fold items */ } else throw e; }","preventionTips":["Don't close the page mid-scroll","Watch for interstitials replacing the results page","Use conservative scroll delayMs on unstable pages"],"tags":["browser-automation","scrolling"],"backgroundTag":"page-evaluate-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}