{"record":{"id":"503cf94fc9deb4b9","repo":"jackwener/OpenCLI","slug":"http-result-httpstatus-from-result-where-503cf9","errorCode":null,"errorMessage":"HTTP ${result.httpStatus} from ${result.where}","messagePattern":"HTTP (.+?) from (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/read.js","lineNumber":572,"sourceCode":"        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    },\n});\n","sourceCodeStart":554,"sourceCodeEnd":589,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/read.js#L554-L589","documentation":"An envelope kind of 'http' means the /comments request completed but Reddit returned a non-success HTTP status (e.g. 403, 404, 429, 503). The CommandExecutionError embeds the status and the URL/where it happened so the caller knows which request failed and how.","triggerScenarios":"Reddit responding 404 for a nonexistent post id, 403 for blocked/forbidden resources, or 429 rate-limit responses after rapid successive reads.","commonSituations":"Typo'd post id (404); scraping too fast from one IP (429); Reddit blocking cloud/datacenter IPs (403); transient 5xx during Reddit incidents.","solutions":["Check the status in the message: 404 → verify the post id; 403 → verify access/auth or IP reputation; 429 → back off and retry later.","Add delays/retries with exponential backoff for 429/5xx.","Confirm the post id is correct using normalizeRedditPostId rules (bare id, t3_ fullname, or full https URL)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!/^[a-z0-9]+$/i.test(postId.replace(/^t3_/i, ''))) throw new Error('Suspicious post id, likely 404');","typeGuard":"null","tryCatchPattern":"try {\n  return await redditRead(postId);\n} catch (e) {\n  const m = /HTTP (\\d+)/.exec(e.message);\n  if (m) {\n    const status = Number(m[1]);\n    if (status === 429 || status >= 500) { await sleep(backoff()); return redditRead(postId); }\n    if (status === 404) return null; // post gone\n  }\n  throw e;\n}","preventionTips":["Throttle requests (per-IP rate limiting) to avoid 429s.","Validate post ids against the alphanumeric pattern before fetching to avoid 404s.","Distinguish retryable statuses (429/5xx) from permanent ones (404) in your retry logic."],"tags":["http","network","rate-limit"],"backgroundTag":"http-error-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}