jackwener/OpenCLI · error · CommandExecutionError
coupang search location evaluation failed: ${error?.message
Error message
coupang search location evaluation failed: ${error?.message || error} What it means
CommandExecutionError thrown when page.evaluate(buildCurrentLocationEvaluate()) fails while determining the current URL before navigating to a filtered page > 1. The current location read is needed to preserve the filtered URL when paginating.
Source
Thrown at clis/coupang/search.js:443
}
const initialPage = filter ? 1 : pageNumber;
const url = `https://www.coupang.com/np/search?q=${encodeURIComponent(query)}&channel=user&page=${initialPage}`;
await page.goto(url).catch((error) => {
throw new CommandExecutionError(`coupang search navigation failed: ${error?.message || error}`);
});
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);View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command; transient redirect races often resolve
- Drop --filter so the paginate-via-location path is skipped
- Use --page 1 to avoid the location-evaluation branch
- Verify the session is not redirected to a login/captcha page
Example fix
// before const locationInfo = await page.evaluate(buildCurrentLocationEvaluate()); // after const locationInfo = await page.evaluate(buildCurrentLocationEvaluate()).catch(() => null); const filteredUrl = new URL(locationInfo?.href || url);
Defensive patterns
Strategy: try-catch
Type guard
function isHttpUrl(u) { try { const url = new URL(u); return url.protocol.startsWith('http'); } catch { return false; } } Try / catch
try { await search({ filter, page: 2 }); } catch (e) { if (/location evaluation failed/.test(e.message)) { return search({ filter, page: 1 }); } throw e; } Prevention
- Avoid combining --filter with --page when redirects are likely
- Retry transient navigation races
- Watch for login/captcha redirects replacing the page
When it happens
Trigger: `coupang search <query> --filter "..." --page 2` where the location-evaluating evaluate rejects — page navigated during evaluate, cross-origin redirect, or browser closed.
Common situations: Filter application triggered an async redirect so evaluate runs mid-navigation; Coupang bot checks redirect to a login/challenge page breaking evaluate context.
Related errors
- Failed to load Booking.com search page: ${err?.message || er
- Failed to open Chess.com analysis board: ${error?.message ||
- coupang add-to-cart navigation failed: ${error?.message || e
- coupang search filtered navigation failed: ${error?.message
- Discord did not finish navigating to the requested channel.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d4309a543f7e9309.
Report an issue: GitHub.