{"record":{"id":"8a82d05012a3655d","repo":"jackwener/OpenCLI","slug":"amazon-definition-commandname-did-not-expose-an","errorCode":null,"errorMessage":"amazon ${definition.commandName} did not expose any ranked items","messagePattern":"amazon (.+?) did not expose any ranked items","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/amazon/rankings.js","lineNumber":217,"sourceCode":"                        continue;\n                    if (dedupeKey)\n                        seenEntityKeys.add(dedupeKey);\n                    results.push(normalized);\n                    if (results.length >= limit)\n                        break;\n                }\n                const pageLinks = uniqueNonEmpty(payload.page_links ?? []);\n                for (const href of pageLinks) {\n                    const absolute = toAbsoluteAmazonUrl(href);\n                    if (!absolute || !isRankingPaginationUrl(definition.listType, absolute))\n                        continue;\n                    if (!visited.has(absolute) && !queue.includes(absolute)) {\n                        queue.push(absolute);\n                    }\n                }\n            }\n            if (results.length === 0) {\n                throw new CommandExecutionError(`amazon ${definition.commandName} did not expose any ranked items`, createEmptyResultHint(definition.commandName));\n            }\n            return results.slice(0, limit);\n        },\n    };\n}\nexport const __test__ = {\n    parseRank,\n    normalizeVisibleCategoryLinks,\n    normalizeRankingCandidate,\n};\n","sourceCodeStart":199,"sourceCodeEnd":228,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/amazon/rankings.js#L199-L228","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the same ranking query in Chrome to confirm the page visibly renders ranked items","Retry with a canonical category URL or a different category","Check for a robot check on the page and retry later or from a different network","Update the library if Amazon changed the page markup"],"exampleFix":"// before\nopencli amazon bestsellers --url 'https://www.amazon.com/b?node=999999999999'\n// after\nopencli amazon bestsellers --url 'https://www.amazon.com/b?node=283155'","handlingStrategy":"validation","validationCode":"if (!categoryUrl || !categoryUrl.includes('amazon.')) throw new Error('provide a valid Amazon category URL before running rankings');","typeGuard":"const isNonEmpty = (v) => Array.isArray(v) && v.length > 0;","tryCatchPattern":"try {\n  const items = await amazonRankings({ listType: 'bestsellers', url });\n} catch (err) {\n  if (err.message.includes('did not expose any ranked items')) {\n    // verify page in Chrome, retry with canonical URL\n  } else throw err;\n}","preventionTips":["Verify the ranking page renders in a normal browser before automating","Use canonical /zgbs/ category URLs","Avoid datacenter IPs that trigger bot pages","Keep the library updated against Amazon markup changes"],"tags":["scraping","empty-result","robot-check"],"backgroundTag":"empty-scrape-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}