{"record":{"id":"6d86f4b8464a29e8","repo":"jackwener/OpenCLI","slug":"amazon-product-page-did-not-expose-product-content","errorCode":null,"errorMessage":"amazon product page did not expose product content (landed on ${landedUrl})","messagePattern":"amazon product page did not expose product content \\(landed on (.+?)\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/amazon/product.js","lineNumber":87,"sourceCode":"    description: 'Amazon product page facts for candidate validation',\n    domain: 'amazon.com',\n    strategy: Strategy.COOKIE,\n    navigateBefore: false,\n    args: [\n        {\n            name: 'input',\n            required: true,\n            positional: true,\n            help: 'ASIN or product URL, for example B0FJS72893',\n        },\n    ],\n    columns: ['asin', 'title', 'price_text', 'rating_value', 'review_count'],\n    func: async (page, kwargs) => {\n        const input = String(kwargs.input ?? '');\n        const payload = await readProductPayload(page, input);\n        if (!cleanText(payload.product_title)) {\n            const landedUrl = cleanText(payload.href) || buildProductUrl(input);\n            throw new CommandExecutionError(`amazon product page did not expose product content (landed on ${landedUrl})`, 'The product page may have changed or hit a robot check. Open the product page in Chrome and retry.');\n        }\n        return [normalizeProductPayload(payload)];\n    },\n});\nexport const __test__ = {\n    normalizeProductPayload,\n};\n","sourceCodeStart":69,"sourceCodeEnd":95,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/amazon/product.js#L69-L95","documentation":"CommandExecutionError thrown by the amazon product command when the fetched page has no product_title, meaning the product content surface was not readable. The message includes the URL actually landed on, helping distinguish redirects, robot checks, and invalid ASINs. The library prefers failing loudly over returning empty product rows.","triggerScenarios":"Running amazon product with an ASIN/URL where readProductPayload returns a payload whose product_title is empty/whitespace after cleanText — e.g. the navigation landed on a robot-check page, a 404/'Sorry, we couldn't find that page' page, or a layout without the title element. The landed URL in the message comes from payload.href or buildProductUrl(input).","commonSituations":"Invalid or mistyped ASIN producing a 404; Amazon captcha/robot interstitial under rapid scraping; product removed or region-locked; Amazon markup change removing the #productTitle selector; redirect to the Amazon home page.","solutions":["Verify the ASIN/URL is valid by opening the landed URL (in the message) in Chrome — if it 404s, fix the input","Complete any captcha shown in Chrome, then retry","Retry with backoff / slower cadence if robot checks are triggered by scraping rate","If the page renders manually with a title, the #productTitle selector likely needs updating for a new layout"],"exampleFix":"// before\nawait opencli.call('amazon product', { input: 'B0FJS7289' }); // wrong ASIN length\n// throws CommandExecutionError('amazon product page did not expose product content ...')\n\n// after\nconst asin = 'B0FJS72893'; // validate 10-char ASIN before calling\nif (/^B0[A-Z0-9]{8}$/.test(asin)) {\n  await opencli.call('amazon product', { input: asin });\n}","handlingStrategy":"validation","validationCode":"function isValidAsin(s) { return /^[A-Z0-9]{10}$/.test(String(s).trim().toUpperCase()); }\nif (!isValidAsin(input)) throw new Error('invalid ASIN: ' + input);","typeGuard":"function isValidAsin(v) {\n  return typeof v === 'string' && /^[A-Z0-9]{10}$/.test(v.trim().toUpperCase());\n}","tryCatchPattern":"try {\n  return await opencli.call('amazon product', { input: asin });\n} catch (e) {\n  if (/did not expose product content/.test(e.message)) {\n    const landed = e.message.match(/landed on (.+?)\\)/)?.[1];\n    // inspect landed URL: 404 -> bad ASIN; captcha -> retry later\n    throw new Error('product scrape failed, landed on ' + landed);\n  }\n  throw e;\n}","preventionTips":["Validate ASIN format (10 alphanumeric chars) before calling","Spot-check the landed URL in the message to distinguish 404s from robot checks","Back off and retry slowly to avoid triggering Amazon anti-bot pages"],"tags":["amazon","scraping","robot-check","invalid-input"],"backgroundTag":"scrape-target-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}