{"record":{"id":"c3d9c08257e3da84","repo":"jackwener/OpenCLI","slug":"reddit-com-c3d9c0","errorCode":"reddit.com","errorMessage":"reddit.com: ${result.detail}","messagePattern":"reddit\\.com: (.+?)","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/reddit/read.js","lineNumber":569,"sourceCode":"        // If we produced nothing beyond the POST row but the comment listing\n        // wasn't empty, that's parser drift (e.g. Reddit changed t1/more\n        // schema). Surface as CommandExecutionError on the Node side.\n        if (rows.length <= 1 && preWalkSize > 0 && t1TopLevel.length > 0) {\n          return { kind: 'parser-drift', detail: 'Reddit comment listing for post ' + postId + ' had ' + t1TopLevel.length + ' t1 entries but walker produced no rows.' };\n        }\n\n        return { kind: 'ok', rows: rows, expandMeta: expandMeta };\n      })()\n    `);\n\n        if (!result || typeof result !== 'object') {\n            throw new CommandExecutionError('Reddit /comments fetch returned no result envelope.');\n        }\n        if (result.kind === 'inaccessible') {\n            throw new EmptyResultError(result.detail);\n        }\n        if (result.kind === 'auth') {\n            throw new AuthRequiredError('reddit.com', result.detail);\n        }\n        if (result.kind === 'http') {\n            throw new CommandExecutionError(`HTTP ${result.httpStatus} from ${result.where}`);\n        }\n        if (result.kind === 'malformed') {\n            throw new CommandExecutionError(result.detail);\n        }\n        if (result.kind === 'parser-drift') {\n            throw new CommandExecutionError(result.detail);\n        }\n        if (result.kind === 'expand-failed') {\n            throw new CommandExecutionError(result.detail);\n        }\n        if (result.kind !== 'ok' || !Array.isArray(result.rows)) {\n            throw new CommandExecutionError(`Unexpected result from reddit read: ${JSON.stringify(result)}`);\n        }\n        return result.rows;\n    },","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/read.js#L551-L587","documentation":"An envelope kind of 'auth' means Reddit returned a login/permission challenge for the request. The command raises AuthRequiredError scoped to host 'reddit.com' with the script's detail message, indicating the cookie-based session is missing or no longer authorized.","triggerScenarios":"Expired or absent reddit.com session cookies while fetching a post that requires login (or any request Reddit answers with a login redirect/challenge).","commonSituations":"Cookies expired after a logout or password change; running headless without ever authenticating; Reddit aggressively challenging a datacenter IP.","solutions":["Re-authenticate: refresh the stored reddit.com cookies via the CLI's auth/login flow.","Log in to reddit.com in the browser session the tool uses, then retry.","If Reddit is challenging your IP, retry from a residential network or after completing any captcha manually."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check session cookies before calling\nconst hasSession = await page.cookies('https://www.reddit.com').then(cs => cs.some(c => c.name === 'session_token' || c.name.startsWith('token')));\nif (!hasSession) await runAuthFlow('reddit.com');","typeGuard":"null","tryCatchPattern":"try {\n  return await redditRead(postId);\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    await refreshRedditCookies();\n    return redditRead(postId);\n  }\n  throw e;\n}","preventionTips":["Refresh reddit.com cookies on a schedule before they expire.","Run the auth/login flow proactively in CI before batch reads.","Avoid datacenter IPs that trigger aggressive Reddit login challenges."],"tags":["authentication","cookies","reddit"],"backgroundTag":"auth-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}