jackwener/OpenCLI · error · CommandExecutionError
${label}: ${String(payload.error)}
Error message
${label}: ${String(payload.error)} What it means
requireArrayEvaluateResult validates that a page.evaluate extraction returned an array. If the injected script returned an object carrying an 'error' key (the in-page error envelope), the error string is rethrown as CommandExecutionError prefixed with the extraction label. Anything else non-array gets the generic malformed-payload message.
Source
Thrown at clis/chatgpt/utils.js:207
// `Array.isArray(payload)` directly on the envelope silently see "no data" —
// this matches the failure mode fixed for xiaohongshu/rednote (#1561) and
// weibo (#1568).
//
// `unwrapEvaluateResult` is a defensive ternary: it unwraps when the payload
// looks like an envelope, otherwise passes the value through unchanged so
// older bridge versions and primitive return values still work.
// ─────────────────────────────────────────────────────────────────────────────
export function unwrapEvaluateResult(payload) {
if (payload && !Array.isArray(payload) && typeof payload === 'object' && 'session' in payload && 'data' in payload) {
return payload.data;
}
return payload;
}
export function requireArrayEvaluateResult(payload, label) {
if (!Array.isArray(payload)) {
if (payload && typeof payload === 'object' && 'error' in payload) {
throw new CommandExecutionError(`${label}: ${String(payload.error)}`);
}
throw new CommandExecutionError(`${label} returned malformed extraction payload`);
}
return payload;
}
export function requireObjectEvaluateResult(payload, label) {
if (!payload || Array.isArray(payload) || typeof payload !== 'object') {
throw new CommandExecutionError(`${label} returned malformed extraction payload`);
}
return payload;
}
export function requireBooleanEvaluateResult(payload, label) {
if (typeof payload !== 'boolean') {
throw new CommandExecutionError(`${label} returned malformed extraction payload`);
}
return payload;View on GitHub (pinned to 49907e53dc)
Solutions
- Read the ${label}: <error> text — it is the in-page script's own error message; fix the underlying condition (e.g. wait for the page to load)
- Retry the command after the page finishes rendering
- Verify you are on a chatgpt.com conversation/page the extractor supports
- Update the opencli package if ChatGPT's DOM changed (selector drift)
Example fix
// before
const items = await getChatGPTVisibleImageUrls(page); // throws 'image urls: selector not found'
// after
await page.waitForSelector('[data-testid="conversation"]', { timeout: 15000 });
const items = await getChatGPTVisibleImageUrls(page); Defensive patterns
Strategy: try-catch
Type guard
function isArrayEvaluatePayload(p) { return Array.isArray(p); } Try / catch
try { items = await getChatGPTVisibleImageUrls(page); } catch (e) { if (e instanceof CommandExecutionError) { console.error('extraction failed:', e.message); /* retry after wait */ } else throw e; } Prevention
- Wait for the conversation DOM to render before extracting
- Only run extractions on chatgpt.com pages
- Read the '<label>: <error>' prefix — it carries the in-page cause
- Keep opencli updated for ChatGPT DOM changes
When it happens
Trigger: A chatgpt extraction script running in page.evaluate hits an in-page exception and returns {error: '...'}, or the page DOM changed so the script returns a non-array object/null.
Common situations: ChatGPT UI update renaming selectors, page not fully loaded so the target list is undefined, or being on a page where the extraction script bails with its own error envelope.
Related errors
- ${label} returned malformed extraction payload
- coupang add-to-cart evaluation failed: ${error?.message || e
- Douyin search: unexpected evaluator payload shape
- `Failed to read facebook feed: ${err instanceof Error ? err.
- Jimeng whoami failed: ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c90c9c9193ed1a1a.
Report an issue: GitHub.