jackwener/OpenCLI · error · CommandExecutionError
subreddit-info failed: ${result.detail}
Error message
subreddit-info failed: ${result.detail} What it means
CommandExecutionError thrown when the page.evaluate IIFE that fetches /r/<name>/about.json itself throws an exception inside the browser (e.g. JSON.parse failure, network error, CSP block). The browser-side error is caught, wrapped as {kind:'exception', detail}, and re-thrown on the Node side prefixed with 'subreddit-info failed:'.
Source
Thrown at clis/reddit/subreddit-info.js:86
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
: (typeof s.accounts_active === 'number' ? s.accounts_active : null);
const description = typeof s.public_description === 'string'
? s.public_description.trim()
: '';
return [View on GitHub (pinned to 49907e53dc)
Solutions
- Read the detail after the prefix to see the underlying browser error message
- Check whether an extension (ad-blocker, privacy tool) is blocking reddit.com fetches and disable it for reddit.com
- Verify the browser session has real internet connectivity (no captive portal/proxy injecting HTML)
- Retry — transient network failures often clear on a second run
- Update the CLI/library if the error persists across environments, as the evaluate harness may need a fix
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: confirm the browser can reach reddit.com
await page.goto('https://www.reddit.com', { waitUntil: 'domcontentloaded' }); Type guard
function isSubredditInfoFailure(e){ return e instanceof Error && e.message.startsWith('subreddit-info failed: '); } Try / catch
try { await cli.redditSubredditInfo(name); }
catch (e) {
if (e.message.startsWith('subreddit-info failed: ')) {
console.warn('browser-side error:', e.message);
return retryWithBackoff(() => cli.redditSubredditInfo(name));
}
throw e;
} Prevention
- Disable ad-blockers/privacy extensions for reddit.com
- Ensure stable connectivity (no captive portals) in the browser profile
- Don't navigate or close the browser tab while the command is evaluating
- Retry transient failures with exponential backoff
When it happens
Trigger: Browser-side fetch rejects (network failure, blocked request, CSP), res.json() throws on non-JSON HTML bodies, or any other runtime error inside the evaluated async function.
Common situations: Browser extensions or ad-blockers blocking reddit.com API paths; the page navigating away mid-evaluate; a captive portal / proxy injecting HTML so res.json() throws 'Unexpected token <'; intermittent network drops.
Related errors
- Twitter device-follow fetch failed: ${data.detail || 'unknow
- exception
- ${label} failed: ${error?.message ?? error}
- Barchart greeks request failed: ${data.message || 'unknown e
- Claude whoami failed: ${result.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/34a7291b37a0506e.
Report an issue: GitHub.