jackwener/OpenCLI · error · CommandExecutionError

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

Error message

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

What it means

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.

Source

Thrown at clis/reddit/subreddit-info.js:80

            return { kind: 'missing', detail: 'Subreddit r/' + sub + ' is ' + (j.reason || 'unavailable') + '.' };
          }
          return { kind: 'http', httpStatus: j.error, where: '/r/' + sub + '/about.json (' + (j.reason || 'error') + ')' };
        }
        const info = j?.data;
        if (!info || !info.display_name) {
          return { kind: 'malformed', detail: 'Reddit returned malformed subreddit info for r/' + sub + ' (missing data.display_name).' };
        }
        return { kind: 'ok', info };
      } catch (e) {
        return { kind: 'exception', detail: String(e && e.message || e) };
      }
    })()`);

        if (result?.kind === 'missing') {
            throw new EmptyResultError(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 === 'exception') {
            throw new CommandExecutionError(`subreddit-info failed: ${result.detail}`);
        }
        if (result?.kind !== 'ok') {
            throw new CommandExecutionError(`Unexpected result from reddit subreddit-info: ${JSON.stringify(result)}`);
        }

        const s = result.info;
        const created = s.created_utc
            ? new Date(s.created_utc * 1000).toISOString().split('T')[0]
            : null;
        const subscribers = typeof s.subscribers === 'number' ? s.subscribers : null;
        const activeNow = typeof s.active_user_count === 'number'
            ? s.active_user_count

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Wait a minute or two and retry — 429 usually clears once the rate-limit window resets
  2. Reduce call frequency / add backoff if scripting many lookups
  3. Check https://www.redditstatus.com for a Reddit outage on 5xx statuses
  4. Log into reddit.com in the CLI browser session; authenticated requests get higher limits
  5. Try from a different network/IP if a shared IP is rate-limited

Example fix

// before
for (const s of subs) reddit subreddit-info ${s} // hammers endpoint, 429
// after
for (const s of subs) { await sleep(1500); reddit subreddit-info ${s} }
Defensive patterns

Strategy: retry

Validate before calling

if (process.env.REDDIT_RATE_GUARD && Date.now() - lastCallAt < 1500) await sleep(1500);

Type guard

function isHttpExecutionErr(e){ return e instanceof Error && /^HTTP \d{3} from /.test(e.message); }

Try / catch

try { return await cli.redditSubredditInfo(name); }
catch (e) {
  const m = /^HTTP (\d{3}) from /.exec(e.message);
  if (m && (+m[1] === 429 || +m[1] >= 500)) { await backoffRetry(3); return; }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Rapid repeated CLI calls tripping Reddit rate limits; Reddit outage windows; aggressive shared-IP scraping (CI runners, VPN exit nodes); WAF interstitials.

Related errors


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