{"record":{"id":"fb74de24b7a68696","repo":"jackwener/OpenCLI","slug":"result-detail-fb74de","errorCode":null,"errorMessage":"${result.detail}","messagePattern":"\\$\\{result\\.detail\\}","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subreddit-info.js","lineNumber":77,"sourceCode":"        // not found / not accessible\" by the absence of data.display_name.\n        if (j?.error) {\n          if (j.error === 404 || j.reason === 'banned' || j.reason === 'private' || j.reason === 'quarantined') {\n            return { kind: 'missing', detail: 'Subreddit r/' + sub + ' is ' + (j.reason || 'unavailable') + '.' };\n          }\n          return { kind: 'http', httpStatus: j.error, where: '/r/' + sub + '/about.json (' + (j.reason || 'error') + ')' };\n        }\n        const info = j?.data;\n        if (!info || !info.display_name) {\n          return { kind: 'malformed', detail: 'Reddit returned malformed subreddit info for r/' + sub + ' (missing data.display_name).' };\n        }\n        return { kind: 'ok', info };\n      } catch (e) {\n        return { kind: 'exception', detail: String(e && e.message || e) };\n      }\n    })()`);\n\n        if (result?.kind === 'missing') {\n            throw new EmptyResultError(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 === 'exception') {\n            throw new CommandExecutionError(`subreddit-info failed: ${result.detail}`);\n        }\n        if (result?.kind !== 'ok') {\n            throw new CommandExecutionError(`Unexpected result from reddit subreddit-info: ${JSON.stringify(result)}`);\n        }\n\n        const s = result.info;\n        const created = s.created_utc\n            ? new Date(s.created_utc * 1000).toISOString().split('T')[0]\n            : null;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subreddit-info.js#L59-L95","documentation":"EmptyResultError thrown when the in-browser fetch of /r/<name>/about.json reports the subreddit is missing, banned, private, quarantined, or returns 401/403/404. The library converts these Reddit responses into a typed 'empty result' so the CLI output table never shows a silent placeholder row.","triggerScenarios":"Running `reddit subreddit-info <name>` where the subreddit does not exist, was banned, is private/quarantined, or Reddit's API returns 401/403 for that name (e.g. quarantined sub not opted into).","commonSituations":"Typos in subreddit names, subreddits banned or made private since last use, accessing quarantined subs without an opt-in cookie, region-blocked subs, deleted/rename of the subreddit.","solutions":["Verify the subreddit exists by visiting https://www.reddit.com/r/<name> in a browser while logged in","Re-check spelling; the name must be 3-21 chars, letters/digits/underscore (an r/ prefix is stripped automatically)","If the sub is quarantined, open it once in the browser and click 'Continue' so the session cookie grants access","If private, request access from moderators or use an account that is a member","Log into reddit.com in the CLI's browser session if a 401/403 indicates auth is missing"],"exampleFix":"// before (fails)\nreddit subreddit-info example-sub-that-was-banned\n// after\nreddit subreddit-info python","handlingStrategy":"try-catch","validationCode":"const SUBREDDIT_RE = /^[A-Za-z][A-Za-z0-9_]{2,20}$/;\nconst name = raw.replace(/^\\/r\\//,'').replace(/^r\\//,'').trim();\nif (!SUBREDDIT_RE.test(name)) throw new Error(`invalid subreddit name: ${raw}`);","typeGuard":"function isEmptyResultErr(e){ return e && e.name === 'EmptyResultError'; }","tryCatchPattern":"try { await cli.redditSubredditInfo(name); }\ncatch (e) { if (e.name === 'EmptyResultError') { console.warn(`r/${name} unavailable: ${e.message}`); return null; } throw e; }","preventionTips":["Check the subreddit exists at reddit.com/r/<name> before scripting against it","Validate the name matches Reddit's naming rules before calling","For quarantined/private subs, pre-authorize the browser session by visiting the sub once","Expect EmptyResultError as a normal outcome for deleted/banned subs and handle it as 'no data', not a crash"],"tags":["reddit","empty-result","http-404","authentication"],"backgroundTag":"empty-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}