jackwener/OpenCLI · error · CommandExecutionError
Unexpected result from reddit read: ${JSON.stringify(result)
Error message
Unexpected result from reddit read: ${JSON.stringify(result)} What it means
Final safety check in the reddit read handler: after all known envelope kinds are handled, the result must be kind 'ok' with an array of rows. Anything else (unknown kind, ok without rows array) triggers this CommandExecutionError that stringifies the whole envelope for debugging. It means the script returned a shape the host does not understand.
Source
Thrown at clis/reddit/read.js:584
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
- Read the JSON in the message to see the actual result and its kind.
- Reinstall/upgrade the library so the page script and host handler versions match.
- If kind is 'ok' with missing rows, report a bug — the script's success path is returning a non-array.
Defensive patterns
Strategy: try-catch
Type guard
const isOkEnvelope = (r) => r && typeof r === 'object' && r.kind === 'ok' && Array.isArray(r.rows);
Try / catch
try {
return await redditRead(postId);
} catch (e) {
if (e instanceof CommandExecutionError && /Unexpected result from reddit read/.test(e.message)) {
console.error('Envelope contract violated — reinstall/upgrade the library');
// Log e.message (contains full envelope JSON) for a bug report
}
throw e;
} Prevention
- Keep the injected page script and host handler from the same library version (no partial upgrades).
- Reinstall cleanly if you see this after an update or manual patching.
- Include the stringified envelope from the message when reporting bugs.
When it happens
Trigger: The in-page script returns a new/unknown envelope kind after a library partial update, or returns kind 'ok' but with rows missing/null due to a script bug.
Common situations: Version mismatch between the injected page script and the host handler after an upgrade; manual edits to the script; corrupted install.
Related errors
- Unexpected Reddit probe: ${JSON.stringify(result)}
- Stale .git/index.lock found — remove it first
- Unexpected Amazon probe: ${JSON.stringify(probe)}
- Unexpected Claude probe: ${JSON.stringify(result)}
- Unexpected Coupang probe: ${JSON.stringify(probe)}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f27a5f764d126cd2.
Report an issue: GitHub.