{"record":{"id":"7f86f1a110d8ae73","repo":"jackwener/OpenCLI","slug":"facebook-com-7f86f1","errorCode":null,"errorMessage":"facebook.com","messagePattern":"facebook\\.com","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/facebook/notifications.js","lineNumber":291,"sourceCode":"\nasync function getFacebookNotifications(page, args) {\n    const limit = normalizeNotificationsLimit(args.limit);\n    try {\n        await page.goto(`${FB_HOST}/notifications`, { waitUntil: 'load', settleMs: 3000 });\n    } catch (error) {\n        const message = error instanceof Error ? error.message : String(error);\n        throw new CommandExecutionError(\n            `Failed to navigate to facebook notifications: ${message}`,\n            'facebook.com may be unreachable',\n        );\n    }\n    let rows;\n    try {\n        rows = await page.evaluate(buildNotificationsScript(limit));\n    } catch (error) {\n        const message = error instanceof Error ? error.message : String(error);\n        if (/AUTH_REQUIRED/i.test(message)) {\n            throw new AuthRequiredError(\n                'facebook.com',\n                'Open Chrome and log in to Facebook before retrying',\n            );\n        }\n        throw new CommandExecutionError(\n            `Failed to read facebook notifications: ${message}`,\n            'facebook.com page may not have rendered or markup may have changed',\n        );\n    }\n    if (!Array.isArray(rows) || rows.length === 0) {\n        throw new EmptyResultError(\n            'facebook/notifications',\n            'No notifications found — login session may have expired or you have no recent notifications',\n        );\n    }\n    return rows;\n}\n","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/facebook/notifications.js#L273-L309","documentation":"AuthRequiredError('facebook.com', 'Open Chrome and log in to Facebook before retrying') thrown by getFacebookNotifications when the injected evaluate script fails with a message matching /AUTH_REQUIRED/. This is the user-facing translation of the script-level 'AUTH_REQUIRED: facebook.com redirected to login' error (see 1406).","triggerScenarios":"Running the notifications command while the browser profile has no valid signed-in facebook.com session, so the script detected it was on a login/redirect path and threw AUTH_REQUIRED.","commonSituations":"Session cookies expired overnight; logged out of the profile browser; Facebook invalidated the session (password change, security checkpoint); automation running on a profile that was never logged in.","solutions":["Open Chrome and log in to Facebook, then re-run the notifications command","Confirm facebook.com/notifications loads without redirecting to login in that profile","Complete any Facebook security/2FA checkpoint blocking the session","Persist the profile (user-data-dir) so cookies survive restarts"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const path = await page.evaluate(String.raw`(() => window.location.pathname)()`);\nif (/login|checkpoint/.test(path)) throw new Error('AUTH_REQUIRED');","typeGuard":"const isAuthRequiredError = (e) => e instanceof Error && (e.name === 'AuthRequiredError' || /AUTH_REQUIRED/i.test(e.message));","tryCatchPattern":"try {\n  const rows = await getFacebookNotifications(page, args);\n} catch (e) {\n  if (isAuthRequiredError(e)) {\n    console.error('Open Chrome and log in to Facebook before retrying');\n  } else throw e;\n}","preventionTips":["Log in to Facebook in the managed profile before running notifications","Watch for password changes/session invalidation on the account","Persist the browser profile so cookies survive restarts","Catch AuthRequiredError separately from CommandExecutionError"],"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"}