jackwener/OpenCLI · error · CommandExecutionError

HTTP ${result.httpStatus} from ${result.where}

Error message

HTTP ${result.httpStatus} from ${result.where}

What it means

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.

Source

Thrown at clis/reddit/read.js:572

        if (rows.length <= 1 && preWalkSize > 0 && t1TopLevel.length > 0) {
          return { kind: 'parser-drift', detail: 'Reddit comment listing for post ' + postId + ' had ' + t1TopLevel.length + ' t1 entries but walker produced no rows.' };
        }

        return { kind: 'ok', rows: rows, expandMeta: expandMeta };
      })()
    `);

        if (!result || typeof result !== 'object') {
            throw new CommandExecutionError('Reddit /comments fetch returned no result envelope.');
        }
        if (result.kind === 'inaccessible') {
            throw new EmptyResultError(result.detail);
        }
        if (result.kind === 'auth') {
            throw new AuthRequiredError('reddit.com', result.detail);
        }
        if (result.kind === 'http') {
            throw new CommandExecutionError(`HTTP ${result.httpStatus} from ${result.where}`);
        }
        if (result.kind === 'malformed') {
            throw new CommandExecutionError(result.detail);
        }
        if (result.kind === 'parser-drift') {
            throw new CommandExecutionError(result.detail);
        }
        if (result.kind === 'expand-failed') {
            throw new CommandExecutionError(result.detail);
        }
        if (result.kind !== 'ok' || !Array.isArray(result.rows)) {
            throw new CommandExecutionError(`Unexpected result from reddit read: ${JSON.stringify(result)}`);
        }
        return result.rows;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check the status in the message: 404 → verify the post id; 403 → verify access/auth or IP reputation; 429 → back off and retry later.
  2. Add delays/retries with exponential backoff for 429/5xx.
  3. Confirm the post id is correct using normalizeRedditPostId rules (bare id, t3_ fullname, or full https URL).
Defensive patterns

Strategy: retry

Validate before calling

if (!/^[a-z0-9]+$/i.test(postId.replace(/^t3_/i, ''))) throw new Error('Suspicious post id, likely 404');

Type guard

null

Try / catch

try {
  return await redditRead(postId);
} catch (e) {
  const m = /HTTP (\d+)/.exec(e.message);
  if (m) {
    const status = Number(m[1]);
    if (status === 429 || status >= 500) { await sleep(backoff()); return redditRead(postId); }
    if (status === 404) return null; // post gone
  }
  throw e;
}

Prevention

When it happens

Trigger: Reddit responding 404 for a nonexistent post id, 403 for blocked/forbidden resources, or 429 rate-limit responses after rapid successive reads.

Common situations: Typo'd post id (404); scraping too fast from one IP (429); Reddit blocking cloud/datacenter IPs (403); transient 5xx during Reddit incidents.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/503cf94fc9deb4b9. Report an issue: GitHub.