{"record":{"id":"1a6979f338583492","repo":"jackwener/OpenCLI","slug":"facebook-com-1a6979","errorCode":null,"errorMessage":"facebook.com","messagePattern":"facebook\\.com","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/facebook/marketplace-listings.js","lineNumber":64,"sourceCode":"        const status = windowLines.find((line) => /^(Active|Sold|Pending|Draft)$/i.test(line)) || '';\n        const listed = windowLines.find((line) => /Listed on\\b/i.test(line))?.replace(/^·\\s*/, '') || '';\n        const clickLine = windowLines.find((line) => /clicks? on listing/i.test(line)) || '';\n        const clickMatch = clickLine.match(/([\\d,.]+)\\s+clicks? on listing/i);\n        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__ = {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/facebook/marketplace-listings.js#L46-L82","documentation":"AuthRequiredError thrown when the in-page evaluate script reports authRequired:true for facebook.com, meaning the scrape of Marketplace seller listings detected the user is not signed in. The message text ('Facebook Marketplace seller listings require an active signed-in Facebook session.') instructs the user to establish a session. The site slug 'facebook.com' identifies which site's credentials are needed.","triggerScenarios":"Running `facebook marketplace-listings` while the Chrome profile has no valid facebook.com login; Facebook redirected to login or served logged-out HTML so the parsed rows carry authRequired:true.","commonSituations":"Expired Facebook session cookies; logged out of the profile browser; using a fresh/incognito-like profile; Facebook invalidated the session after a password change or security prompt.","solutions":["Open the managed Chrome browser, sign in to Facebook, then re-run the command","Confirm facebook.com/marketplace/you/selling/ renders your listings while logged in","If 2FA/session verification was triggered, complete it in the browser before retrying","Clear stale cookies only if login still fails, then log in again"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check login state before scraping\nconst loggedIn = await page.evaluate(String.raw`(() => !document.querySelector('form[action*=\"login\"]'))()`);\nif (!loggedIn) throw new Error('Not signed in to facebook.com');","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await runMarketplaceListings();\n} catch (e) {\n  if (e.name === 'AuthRequiredError' && e.site === 'facebook.com') {\n    await promptFacebookLogin(); // open Chrome, sign in, retry\n  } else throw e;\n}","preventionTips":["Keep the profile's Facebook session alive (persisted cookies)","Re-login after password changes or security checkpoints","Verify the selling page renders logged-in content before scripting","Handle AuthRequiredError explicitly rather than generically"],"tags":["auth","facebook","session"],"backgroundTag":"auth-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}