{"record":{"id":"34a7291b37a0506e","repo":"jackwener/OpenCLI","slug":"subreddit-info-failed-result-detail","errorCode":null,"errorMessage":"subreddit-info failed: ${result.detail}","messagePattern":"subreddit-info failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subreddit-info.js","lineNumber":86,"sourceCode":"          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;\n        const subscribers = typeof s.subscribers === 'number' ? s.subscribers : null;\n        const activeNow = typeof s.active_user_count === 'number'\n            ? s.active_user_count\n            : (typeof s.accounts_active === 'number' ? s.accounts_active : null);\n        const description = typeof s.public_description === 'string'\n            ? s.public_description.trim()\n            : '';\n\n        return [","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subreddit-info.js#L68-L104","documentation":"CommandExecutionError thrown when the page.evaluate IIFE that fetches /r/<name>/about.json itself throws an exception inside the browser (e.g. JSON.parse failure, network error, CSP block). The browser-side error is caught, wrapped as {kind:'exception', detail}, and re-thrown on the Node side prefixed with 'subreddit-info failed:'.","triggerScenarios":"Browser-side fetch rejects (network failure, blocked request, CSP), res.json() throws on non-JSON HTML bodies, or any other runtime error inside the evaluated async function.","commonSituations":"Browser extensions or ad-blockers blocking reddit.com API paths; the page navigating away mid-evaluate; a captive portal / proxy injecting HTML so res.json() throws 'Unexpected token <'; intermittent network drops.","solutions":["Read the detail after the prefix to see the underlying browser error message","Check whether an extension (ad-blocker, privacy tool) is blocking reddit.com fetches and disable it for reddit.com","Verify the browser session has real internet connectivity (no captive portal/proxy injecting HTML)","Retry — transient network failures often clear on a second run","Update the CLI/library if the error persists across environments, as the evaluate harness may need a fix"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: confirm the browser can reach reddit.com\nawait page.goto('https://www.reddit.com', { waitUntil: 'domcontentloaded' });","typeGuard":"function isSubredditInfoFailure(e){ return e instanceof Error && e.message.startsWith('subreddit-info failed: '); }","tryCatchPattern":"try { await cli.redditSubredditInfo(name); }\ncatch (e) {\n  if (e.message.startsWith('subreddit-info failed: ')) {\n    console.warn('browser-side error:', e.message);\n    return retryWithBackoff(() => cli.redditSubredditInfo(name));\n  }\n  throw e;\n}","preventionTips":["Disable ad-blockers/privacy extensions for reddit.com","Ensure stable connectivity (no captive portals) in the browser profile","Don't navigate or close the browser tab while the command is evaluating","Retry transient failures with exponential backoff"],"tags":["reddit","browser","exception","network"],"backgroundTag":"browser-evaluation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}