{"record":{"id":"918fad632a01ef97","repo":"jackwener/OpenCLI","slug":"http-result-httpstatus-from-result-where-918fad","errorCode":null,"errorMessage":"HTTP ${result.httpStatus} from ${result.where}","messagePattern":"HTTP (.+?) from (.+?)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subreddit-info.js","lineNumber":80,"sourceCode":"            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;\n        const subscribers = typeof s.subscribers === 'number' ? s.subscribers : null;\n        const activeNow = typeof s.active_user_count === 'number'\n            ? s.active_user_count","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subreddit-info.js#L62-L98","documentation":"CommandExecutionError thrown when the browser-side fetch of /r/<name>/about.json returns an HTTP status that is not 401/403/404 and not an error envelope — e.g. 429 rate-limit or 5xx. The message includes the numeric status and the endpoint path for diagnosis.","triggerScenarios":"Reddit's about.json endpoint responding 429 (too many requests), 500/502/503 (server-side outage), or an envelope body with j.error not equal to 404 for reasons other than banned/private/quarantined.","commonSituations":"Rapid repeated CLI calls tripping Reddit rate limits; Reddit outage windows; aggressive shared-IP scraping (CI runners, VPN exit nodes); WAF interstitials.","solutions":["Wait a minute or two and retry — 429 usually clears once the rate-limit window resets","Reduce call frequency / add backoff if scripting many lookups","Check https://www.redditstatus.com for a Reddit outage on 5xx statuses","Log into reddit.com in the CLI browser session; authenticated requests get higher limits","Try from a different network/IP if a shared IP is rate-limited"],"exampleFix":"// before\nfor (const s of subs) reddit subreddit-info ${s} // hammers endpoint, 429\n// after\nfor (const s of subs) { await sleep(1500); reddit subreddit-info ${s} }","handlingStrategy":"retry","validationCode":"if (process.env.REDDIT_RATE_GUARD && Date.now() - lastCallAt < 1500) await sleep(1500);","typeGuard":"function isHttpExecutionErr(e){ return e instanceof Error && /^HTTP \\d{3} from /.test(e.message); }","tryCatchPattern":"try { return await cli.redditSubredditInfo(name); }\ncatch (e) {\n  const m = /^HTTP (\\d{3}) from /.exec(e.message);\n  if (m && (+m[1] === 429 || +m[1] >= 500)) { await backoffRetry(3); return; }\n  throw e;\n}","preventionTips":["Throttle lookups when iterating many subreddits (e.g. >=1s between calls)","Avoid shared/flagged IPs (VPN exits, CI egress) for Reddit API traffic","Monitor redditstatus.com during suspected outages","Prefer authenticated browser sessions, which get better rate limits"],"tags":["reddit","http-error","rate-limit","network"],"backgroundTag":"http-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}