jackwener/OpenCLI · error · CommandExecutionError
Reply failed: ${result.detail}
Error message
Reply failed: ${result.detail} What it means
Thrown by the reddit `reply` command when the in-page script throws a JavaScript exception inside page.evaluate (result.kind === 'exception'). The browser-side try/catch converts the thrown error to a string and this error surfaces it as `Reply failed: <detail>`. It means the automation script itself crashed (DOM change, null access, network failure inside the page), not that Reddit rejected the content.
Source
Thrown at clis/reddit/reply.js:175
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
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 === 'reddit-error') {
throw new CommandExecutionError(`Reddit rejected reply: ${result.detail}`);
}
if (result?.kind === 'postcondition') {
throw new CommandExecutionError(result.detail);
}
if (result?.kind === 'exception') {
throw new CommandExecutionError(`Reply failed: ${result.detail}`);
}
if (result?.kind !== 'ok') {
throw new CommandExecutionError(`Unexpected result from reddit reply: ${JSON.stringify(result)}`);
}
return [{ status: 'success', message: result.detail }];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Read the `detail` suffix to identify the underlying in-page exception
- Check that the browser session is on a normal reddit.com page, not an error or captcha interstitial
- Update the CLI/automation script if Reddit changed its DOM or API endpoints
- Retry once after a delay in case of a transient in-page network failure
- Catch CommandExecutionError and fall back to manual posting
Example fix
// before
await cli.run('reddit reply', { 'post-id': id, text });
// after
try {
await cli.run('reddit reply', { 'post-id': id, text });
} catch (e) {
if (e.message.startsWith('Reply failed:')) await new Promise(r => setTimeout(r, 2000)).then(() => retry());
else throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm a healthy session page before invoking:
if (!page || !page.url().includes('reddit.com')) throw new Error('Open reddit.com in the session first'); Type guard
function isExceptionResult(r) {
return r != null && typeof r === 'object' && r.kind === 'exception' && typeof r.detail === 'string';
} Try / catch
try {
await cli.run('reddit reply', { 'post-id': postId, text });
} catch (e) {
if (e.message.startsWith('Reply failed:')) {
console.error('In-page exception:', e.message);
await sleep(2000); // retry once for transient in-page failures
} else throw e;
} Prevention
- Keep the CLI updated — Reddit DOM/API changes break the injected script
- Watch for captcha/blocked interstitials in the browser session
- Retry once with backoff for transient in-page network errors
When it happens
Trigger: Calling the reddit reply command when the page.evaluate async function throws: e.g. a fetch inside the page fails, a DOM element the script expects (comment box, submit button) is missing, or an unhandled null/undefined access in the injected script.
Common situations: Reddit UI/markup changes breaking selectors the injected script relies on; Reddit serving an interstitial (blocked, captcha) page instead of the post; intermittent network failures inside the browser session.
Related errors
- ${label}: ${String(payload.error)}
- ${label} returned malformed extraction payload
- coupang add-to-cart evaluation failed: ${error?.message || e
- Douyin search: unexpected evaluator payload shape
- Jimeng whoami failed: ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1bb58885895e8e19.
Report an issue: GitHub.