jackwener/OpenCLI · error · CommandExecutionError
UISDC news page returned an unreadable payload
Error message
UISDC news page returned an unreadable payload
What it means
toRows validates the payload returned by the in-page extraction script. If the payload is null, undefined, or not an object, it throws CommandExecutionError 'UISDC news page returned an unreadable payload', meaning page.evaluate did not return the expected structured result.
Source
Thrown at clis/uisdc/news.js:54
};
}
const rows = cards.map((el, index) => {
const anchor = el.querySelector('a[href]');
return {
rank: index + 1,
title: el.querySelector('.dubao-title')?.textContent || '',
summary: el.querySelector('.dubao-content')?.textContent || '',
url: anchor ? new URL(anchor.getAttribute('href'), location.href).href : '',
};
});
return { ok: true, rows };
})()
`;
}
function toRows(payload, limit) {
if (!payload || typeof payload !== 'object') {
throw new CommandExecutionError('UISDC news page returned an unreadable payload');
}
if (!payload.ok) {
const reason = typeof payload.reason === 'string' && payload.reason.trim() ? payload.reason.trim() : 'selector-drift';
throw new CommandExecutionError(
`UISDC news selector drift: ${reason}`,
payload.title ? `Page title: ${payload.title}` : undefined,
);
}
const rows = (Array.isArray(payload.rows) ? payload.rows : [])
.map((row, index) => ({
rank: index + 1,
title: normalizeText(row.title),
summary: normalizeText(row.summary),
url: normalizeText(row.url),
}))
.filter((row) => row.title && row.url);
if (rows.length === 0) {
throw new EmptyResultError('uisdc news', 'UISDC news page loaded, but no news rows with title and URL were extracted.');View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command; transient redirects or slow loads often resolve on a second run
- Check that UISDC_NEWS_URL loads normally in a browser (not blocked or redirected)
- Inspect the page's anti-bot behavior; use a visible/headed browser if the site blocks automation
- File/inspect buildExtractUisdcNewsJs to ensure it always returns an object
Defensive patterns
Strategy: try-catch
Validate before calling
const payload = await page.evaluate(js).catch(() => null);
if (!payload || typeof payload !== 'object') throw new Error('extraction returned no object'); Type guard
function isReadablePayload(p) { return !!p && typeof p === 'object' && !Array.isArray(p); } Try / catch
try { const rows = await loadUisdcNews(page, args); } catch (e) { if (/unreadable payload/.test(e.message)) { await retryWithFreshPage(); } else throw e; } Prevention
- Retry once with a freshly navigated page before giving up
- Confirm the URL isn't redirecting to a login/captcha wall
- Log page.url() and title on failure for diagnosis
- Keep the extraction script returning an explicit object in all paths
When it happens
Trigger: page.evaluate(buildExtractUisdcNewsJs()) resolving to null/undefined or a non-object (e.g. a serialized string), or the injected script returning nothing after navigation problems.
Common situations: Page redirected to an error/login/captcha page so the extractor returned undefined; automation framework serialization quirk; SPA rewrote the DOM before the script's guarded return.
Related errors
- Discord search returned malformed browser payload.
- ${command} returned an unreadable browser payload
- ${command} returned a malformed rows payload
- UISDC news selector drift: ${reason}
- Failed to extract UISDC news: ${getErrorMessage(error)}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a0a262ebde7c3533.
Report an issue: GitHub.