{"record":{"id":"553fafbaa5845517","repo":"jackwener/OpenCLI","slug":"http-result-httpstatus-from-result-where-553faf","errorCode":null,"errorMessage":"HTTP ${result.httpStatus} from ${result.where}","messagePattern":"HTTP (.+?) from (.+?)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subscribed.js","lineNumber":148,"sourceCode":"          after = next;\n        }\n        if (out.length < target && after) {\n          return { kind: 'malformed', detail: 'Reddit subscriptions pagination exceeded the safety cap before satisfying the requested limit.' };\n        }\n        return { kind: 'ok', entries: out };\n      } catch (e) {\n        return { kind: 'exception', detail: String(e && e.message || e) };\n      }\n    })()`));\n        if (result?.kind === 'login-wall') {\n            // Convert the browser-side sentinel into a typed LoginWallError on the Node side.\n            throwIfLoginWall(result.sentinel, { url: result.where });\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 === 'exception') {\n            throw new CommandExecutionError(`subscribed failed: ${result.detail}`);\n        }\n        if (result?.kind !== 'ok' || !Array.isArray(result.entries)) {\n            throw new CommandExecutionError(`Unexpected result from reddit subscribed: ${JSON.stringify(result)}`);\n        }\n        const rows = result.entries.slice(0, limit).map((entry, index) => mapSubredditRow(entry, index));\n        if (rows.length === 0) {\n            throw new EmptyResultError('Reddit returned no subscribed subreddits for the logged-in account.');\n        }\n        return rows;\n    }\n});\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subscribed.js#L130-L166","documentation":"When the browser-side probe reports {kind:'http', httpStatus, where}, subscribed.js throws CommandExecutionError with `HTTP ${result.httpStatus} from ${result.where}`. It means the Reddit API endpoint responded with a non-2xx HTTP status while fetching the subscribed list. The library converts raw HTTP failures into a uniform CLI error carrying the status and URL.","triggerScenarios":"The in-page fetch to reddit.com subscribed endpoints returns 403/429/5xx; e.g. Reddit blocks the request, rate-limits the account, or the endpoint path changed and returns 404.","commonSituations":"Reddit rate limiting after rapid repeated CLI calls; 403 from Reddit's anti-bot/proxy detection; 404 after a Reddit API change; transient 5xx server errors.","solutions":["Read the status in the message: 403 -> open reddit.com in the attached browser and complete any challenge/verify login; 429 -> wait and back off; 404/5xx -> check whether the Reddit endpoint changed.","Reduce call frequency or add retry with exponential backoff around the command.","Ensure the attached browser profile has normal user-agent/cookies (avoid detection-triggering setups).","Catch CommandExecutionError and inspect the HTTP status before deciding to retry or abort."],"exampleFix":"// before\nawait run(['reddit', 'subscribed']); // throws HTTP 429 from https://www.reddit.com/...\n// after\nfor (let attempt = 0; attempt < 3; attempt++) {\n  try { return await run(['reddit', 'subscribed']); }\n  catch (e) {\n    if (!/HTTP 429/.test(String(e.message))) throw e;\n    await new Promise(r => setTimeout(r, 2 ** attempt * 5000));\n  }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await run(['reddit', 'subscribed']);\n} catch (e) {\n  const m = /HTTP (\\d{3}) from (.+)/.exec(e.message);\n  if (m && (m[1] === '429' || m[1].startsWith('5'))) {\n    await sleep(backoff(attempt)); // retry with exponential backoff\n  } else throw e;\n}","preventionTips":["Throttle reddit CLI calls to avoid 429 rate limiting","Add exponential backoff retries around 429/5xx responses","Use a normal browser profile (avoid proxy setups that trigger 403)","Monitor message text for status codes to classify failures"],"tags":["http","reddit","rate-limit"],"backgroundTag":"http-error-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}