{"record":{"id":"15e14853af406f1d","repo":"jackwener/OpenCLI","slug":"coupang-search","errorCode":null,"errorMessage":"coupang search","messagePattern":"coupang search","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/coupang/search.js","lineNumber":436,"sourceCode":"            throw new ArgumentError('query cannot be empty');\n        }\n        const pageNumber = parsePageArg(kwargs.page, 1);\n        const limit = parseLimitArg(kwargs.limit, 20, 50);\n        const filter = String(kwargs.filter || '').trim().toLowerCase();\n        if (filter && filter !== 'rocket') {\n            throw new ArgumentError(`Unsupported --filter \"${filter}\" (supported: rocket)`);\n        }\n        const initialPage = filter ? 1 : pageNumber;\n        const url = `https://www.coupang.com/np/search?q=${encodeURIComponent(query)}&channel=user&page=${initialPage}`;\n        await page.goto(url).catch((error) => {\n            throw new CommandExecutionError(`coupang search navigation failed: ${error?.message || error}`);\n        });\n        if (filter) {\n            const filterResult = await page.evaluate(buildApplyFilterEvaluate(filter)).catch((error) => {\n                throw new CommandExecutionError(`coupang search filter evaluation failed: ${error?.message || error}`);\n            });\n            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        });","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coupang/search.js#L418-L454","documentation":"CommandExecutionError thrown when the in-page evaluation that applies a Coupang search filter (buildApplyFilterEvaluate) throws inside page.evaluate. The wrapper rethrows with the inner error message so the CLI surfaces a 'coupang search filter evaluation failed: ...' message instead of a raw browser exception.","triggerScenarios":"Running `coupang search <query> --filter \"...\"` when the evaluate that applies the filter throws — e.g. the filter bar DOM changed, the page navigated mid-evaluate, or the page evaluate API itself rejected.","commonSituations":"Coupang markup changed after an A/B update; filter applied too early before the filter bar rendered; browser tab crashed or page closed mid-command; Chrome extension injecting scripts that break evaluate.","solutions":["Retry the command without --filter to confirm the failure is filter-specific","Wait for the search results/filter bar to fully render before retrying","Update the CLI to a version matching current Coupang markup","Check that Chrome/the browser session is alive and not crashed"],"exampleFix":"// before\nawait page.evaluate(buildApplyFilterEvaluate(filter));\n// after\nawait page.wait(2);\nawait page.evaluate(buildApplyFilterEvaluate(filter)).catch(e => {\n  console.warn('filter apply failed, continuing without filter', e);\n});","handlingStrategy":"try-catch","validationCode":"if (typeof filter !== 'string' || !filter.trim()) throw new Error('--filter must be a non-empty string');","typeGuard":"function isNonEmptyString(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"try { await coupangSearch({ query, filter }); } catch (e) { if (e instanceof CommandExecutionError && /filter evaluation failed/.test(e.message)) { /* retry without --filter */ } else throw e; }","preventionTips":["Verify the filter name exists on Coupang's current filter bar","Retry once without --filter before failing hard","Keep the CLI updated with Coupang markup changes"],"tags":["browser-automation","dom","filter"],"backgroundTag":"page-evaluate-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}