{"record":{"id":"97e644eb7e538f91","repo":"jackwener/OpenCLI","slug":"facebook-marketplace-listings","errorCode":null,"errorMessage":"facebook marketplace-listings","messagePattern":"facebook marketplace-listings","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/facebook/marketplace-listings.js","lineNumber":68,"sourceCode":"        const actions = windowLines.filter((line) => /^(Mark as sold|Mark as available|Relist this item|Share|Boost listing)$/i.test(line));\n        out.push({\n          title,\n          price: lines[i],\n          status,\n          listed,\n          clicks: clickMatch ? clickMatch[1] : '',\n          actions,\n        });\n      }\n      return { authRequired: false, rows: out };\n    })()`);\n\n    if (result?.authRequired) {\n      throw new AuthRequiredError('facebook.com', 'Facebook Marketplace seller listings require an active signed-in Facebook session.');\n    }\n    const items = Array.isArray(result?.rows) ? result.rows : [];\n    if (items.length === 0) {\n      throw new EmptyResultError('facebook marketplace-listings', 'No seller listings were visible. Check that Marketplace selling is available for this account.');\n    }\n    return items.slice(0, limit).map((item, index) => ({\n      index: index + 1,\n      title: item.title || '',\n      price: item.price || '',\n      status: item.status || '',\n      listed: item.listed || '',\n      clicks: item.clicks || '',\n      actions: Array.isArray(item.actions) ? item.actions.join(', ') : String(item.actions || ''),\n    }));\n  },\n});\n\nexport const __test__ = {\n  normalizeLimit,\n};\n","sourceCodeStart":50,"sourceCodeEnd":85,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/facebook/marketplace-listings.js#L50-L85","documentation":"EmptyResultError thrown when the authenticated Marketplace seller-listings scrape returned zero rows. It is raised only after authRequired was false, so the session was valid but no listing rows were parsed. This signals empty data or a markup mismatch rather than an auth or navigation problem.","triggerScenarios":"`facebook marketplace-listings` on an account with no items for sale; the selling page loaded but the row selectors matched nothing (Facebook DOM change); the page had not finished rendering seller listings when the script scraped it.","commonSituations":"New seller account with zero listings; all listings deleted/archived; regional account without Marketplace selling; silent Facebook markup update breaking selectors.","solutions":["Confirm facebook.com/marketplace/you/selling/ shows listings in the logged-in browser","Re-run the command to rule out slow SPA rendering","Create/publish a listing if the account genuinely has none","If rows exist in-browser but not via the CLI, update the evaluate script's selectors to the current Facebook markup"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify listings exist in-browser before scraping\nconst hasListings = await page.evaluate(String.raw`(() => document.querySelectorAll('[role=\"main\"] a[href*=\"/marketplace/item/\"]').length > 0)()`);","typeGuard":"const isNonEmptyArray = (v) => Array.isArray(v) && v.length > 0;","tryCatchPattern":"try {\n  const rows = await runMarketplaceListings();\n} catch (e) {\n  if (/No seller listings were visible/.test(e.message)) {\n    console.warn('No listings for this account; returning empty output');\n  } else throw e;\n}","preventionTips":["Confirm the account has active listings before scraping","Re-run once to rule out slow rendering","Treat this as 'no data', not a failure, in automation","Update scrape selectors when Facebook changes markup"],"tags":["empty-result","scraping","facebook"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}