jackwener/OpenCLI · error · CommandExecutionError

amazon ${definition.commandName} did not expose any ranked i

Error message

amazon ${definition.commandName} did not expose any ranked items

What it means

This CommandExecutionError is thrown by the amazon rankings command when the scraped page yields zero ranked items after parsing. The library treats an empty result set as a failure because Amazon ranking pages (bestsellers/new-releases) should always render at least some items, so an empty parse usually means the page structure changed, the query was redirected, or a robot check blocked rendering. It is thrown with a command-specific hint telling the user how to produce an empty result workaround.

Source

Thrown at clis/amazon/rankings.js:217

                        continue;
                    if (dedupeKey)
                        seenEntityKeys.add(dedupeKey);
                    results.push(normalized);
                    if (results.length >= limit)
                        break;
                }
                const pageLinks = uniqueNonEmpty(payload.page_links ?? []);
                for (const href of pageLinks) {
                    const absolute = toAbsoluteAmazonUrl(href);
                    if (!absolute || !isRankingPaginationUrl(definition.listType, absolute))
                        continue;
                    if (!visited.has(absolute) && !queue.includes(absolute)) {
                        queue.push(absolute);
                    }
                }
            }
            if (results.length === 0) {
                throw new CommandExecutionError(`amazon ${definition.commandName} did not expose any ranked items`, createEmptyResultHint(definition.commandName));
            }
            return results.slice(0, limit);
        },
    };
}
export const __test__ = {
    parseRank,
    normalizeVisibleCategoryLinks,
    normalizeRankingCandidate,
};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the same ranking query in Chrome to confirm the page visibly renders ranked items
  2. Retry with a canonical category URL or a different category
  3. Check for a robot check on the page and retry later or from a different network
  4. Update the library if Amazon changed the page markup

Example fix

// before
opencli amazon bestsellers --url 'https://www.amazon.com/b?node=999999999999'
// after
opencli amazon bestsellers --url 'https://www.amazon.com/b?node=283155'
Defensive patterns

Strategy: validation

Validate before calling

if (!categoryUrl || !categoryUrl.includes('amazon.')) throw new Error('provide a valid Amazon category URL before running rankings');

Type guard

const isNonEmpty = (v) => Array.isArray(v) && v.length > 0;

Try / catch

try {
  const items = await amazonRankings({ listType: 'bestsellers', url });
} catch (err) {
  if (err.message.includes('did not expose any ranked items')) {
    // verify page in Chrome, retry with canonical URL
  } else throw err;
}

Prevention

When it happens

Trigger: Running `opencli amazon bestsellers`/`new-releases`/`movers-and-shakers` with a category or URL whose rendered page contains no parseable ranked rows; a limit/filter combination that excludes everything; the page rendering a captcha or 'Sorry' page instead of the ranking grid.

Common situations: Amazon A/B tests a new ranking layout breaking selectors; user is behind a datacenter IP triggering a robot check; the passed URL points to a localized page with a different DOM; the category page soft-fails and returns an empty shell.

Related errors


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