jackwener/OpenCLI · error · CommandExecutionError

amazon search did not expose any product cards

Error message

amazon search did not expose any product cards

What it means

Thrown when the amazon search command fetched the search results page but found no product cards with both a valid ASIN and title after filtering. Since Amazon search always renders product cards for real queries, zero cards indicates the page changed, the query returned nothing usable, or a bot-detection interstitial replaced the results.

Source

Thrown at clis/amazon/search.js:81

        },
        {
            name: 'limit',
            type: 'int',
            default: 20,
            help: 'Maximum number of results to return (default 20)',
        },
    ],
    columns: ['rank', 'asin', 'title', 'price_text', 'rating_value', 'review_count'],
    func: async (page, kwargs) => {
        const query = String(kwargs.query ?? '');
        const limit = Math.max(1, Number(kwargs.limit) || 20);
        const payload = await readSearchPayload(page, query);
        const sourceUrl = cleanText(payload.href) || buildSearchUrl(query);
        const cards = (payload.cards ?? [])
            .filter((card) => cleanText(card.asin) && cleanText(card.title))
            .slice(0, limit);
        if (cards.length === 0) {
            throw new CommandExecutionError('amazon search did not expose any product cards', 'The search page may have changed or hit a robot check. Open the same query in Chrome, verify the page is visible, and retry.');
        }
        return cards.map((card, index) => normalizeSearchCandidate(card, index + 1, sourceUrl));
    },
});
export const __test__ = {
    normalizeSearchCandidate,
};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the same query in Chrome and verify product cards are visible, then retry
  2. Simplify or rephrase the search query
  3. Retry from a residential IP or after clearing the robot check
  4. Upgrade the library if Amazon changed search-result markup

Example fix

// before
opencli amazon search 'q=#$%'
// after
opencli amazon search 'wireless earbuds'
Defensive patterns

Strategy: validation

Validate before calling

if (!query || !query.trim()) throw new Error('search query must be non-empty');

Type guard

const hasCards = (payload) => Array.isArray(payload?.cards) && payload.cards.some((c) => c?.asin && c?.title);

Try / catch

try {
  const results = await amazonSearch({ query });
} catch (err) {
  if (err.message.includes('did not expose any product cards')) {
    // rephrase query or check for robot check, retry
  } else throw err;
}

Prevention

When it happens

Trigger: `opencli amazon search <query>` where the rendered page has no cards passing the (asin && title) filter; robot check page; region redirect to a page with different markup; misspelled/unicode query that yields a no-results page styled differently.

Common situations: Running from a cloud/VPN IP flagged by Amazon; query in a language the marketplace doesn't support; Amazon markup update breaking card extraction; sponsored-only layouts the parser can't read.

Related errors


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