jackwener/OpenCLI · error · CommandExecutionError

amazon ${action} hit a robot check

Error message

amazon ${action} hit a robot check

What it means

A CommandExecutionError thrown by assertUsableState when the loaded Amazon page state matches the robot-check pattern (isRobotState). Amazon served a CAPTCHA/verify page instead of real content, so the library aborts with a challenge hint rather than returning garbage or empty data. It is detected in every read path: search, product, discussion, offers, and rankings.

Source

Thrown at clis/amazon/shared.js:395

    try {
        await page.goto(url, { settleMs });
        await page.wait(1.5);
        return await readPageState(page);
    }
    catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        if (message.includes('Inspected target navigated or closed')
            || message.includes('Cannot find context with specified id')
            || message.includes('Target closed')) {
            throw new CommandExecutionError(`amazon ${action} navigation lost the current browser target`, `${buildChallengeHint(action)} If CDP is attached to a stale tab, open a fresh Amazon tab and retry.`);
        }
        throw error;
    }
}
export function assertUsableState(state, action) {
    if (!isRobotState(state))
        return;
    throw new CommandExecutionError(`amazon ${action} hit a robot check`, buildChallengeHint(action));
}
export const __test__ = {
    buildSearchUrl,
    extractAsin,
    amazonHostFromInput,
    buildProductUrl,
    buildDiscussionUrl,
    normalizeProductUrl,
    canonicalizeAmazonUrl,
    resolveBestsellersUrl,
    resolveRankingUrl,
    isSupportedRankingPath,
    isRankingPaginationUrl,
    extractCategoryNodeId,
    parsePriceText,
    parseRatingValue,
    parseReviewCount,
    extractReviewCountFromCardText,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Solve the robot check manually in the attached Chrome tab, then retry
  2. Switch to a residential IP or different network/proxy
  3. Slow down request rate and add delays between commands
  4. Reuse a logged-in browser session with real cookies instead of a clean headless profile

Example fix

// before
for (const asin of asins) await amazonProduct(asin); // rapid-fire
// after
for (const asin of asins) {
  await amazonProduct(asin);
  await new Promise((r) => setTimeout(r, 5000));
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-check the page before parsing:
const html = await page.content();
if (/captcha|Enter the characters you see below/i.test(html)) throw new Error('robot check present — solve it manually first');

Try / catch

try {
  const data = await amazonSearch({ query });
} catch (err) {
  if (err.message.includes('hit a robot check')) {
    await sleep(30000);          // back off
    // or pause and let a human solve the CAPTCHA in the attached tab
    return amazonSearch({ query });
  } else throw err;
}

Prevention

When it happens

Trigger: Any amazon read command (search/product/discussion/offer/rankings) where the rendered page contains Amazon's bot-detection interstitial — typically triggered by datacenter IPs, high request rates, missing cookies, or headless browser fingerprints.

Common situations: Running automation from AWS/GitHub Actions/CI IPs; scraping too many pages per minute; reusing a session that already tripped a challenge; headless Chrome fingerprint detection; regional blocks.

Related errors


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