jackwener/OpenCLI · error · CommandExecutionError
Youdao note extractor returned a malformed payload
Error message
Youdao note extractor returned a malformed payload
What it means
CommandExecutionError thrown by normalizeExtractionResult when the payload returned by the in-page extractor is not an array (even after unwrapEvaluateResult unwraps {session,data} envelopes). The extractor contract requires [ok, ...fields]; anything else means the page runtime changed or evaluate returned something unexpected, so the library cannot interpret the result.
Source
Thrown at clis/youdao/note.js:175
var aiPayload = JSON.parse(ai.aiSummary);
summary = cleanText(aiPayload.description || '');
if (Array.isArray(aiPayload.keywords)) {
for (var i = 0; i < aiPayload.keywords.length; i += 1) {
var keyword = aiPayload.keywords[i];
if (keyword && keyword.title) keywords.push(cleanText(((keyword.emoji || '') + ' ' + keyword.title).trim()));
}
}
} catch {}
}
return [true, title, content, summary, keywords.join(' | '), contentData.ct || null, contentData.sz || null, hasContentField, rawContent.length, window.location.href];
})()
`;
}
function normalizeExtractionResult(payload, sourceUrl) {
const data = unwrapEvaluateResult(payload);
if (!Array.isArray(data)) {
throw new CommandExecutionError('Youdao note extractor returned a malformed payload');
}
const ok = data[0] === true;
if (!ok) {
const reason = typeof data[1] === 'string' && data[1].trim() ? data[1].trim() : 'unknown_parser_failure';
if (reason === 'auth') {
throw new AuthRequiredError('note.youdao.com', 'Youdao shared note requires login or additional permission');
}
if (reason === 'not_found') {
throw new EmptyResultError('youdao note', 'The shared note is missing, expired, cancelled, or inaccessible.');
}
throw new CommandExecutionError(`Youdao note parser failed: ${reason}`);
}
const title = String(data[1] ?? '');
const content = String(data[2] ?? '');
const summary = String(data[3] ?? '');
const keywords = String(data[4] ?? '');
const createTime = data[5];
const fileSize = data[6];View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command; transient SPA navigation or hydration timing can corrupt the evaluate result
- Update the CLI/library to the latest version in case the extractor was patched for Youdao page changes
- Increase post-load wait before evaluate (the command already waits ~2s) or reduce extension interference by running with a clean browser profile
- Inspect the raw payload (log it) to see what shape evaluate actually returned and report it upstream
Defensive patterns
Strategy: try-catch
Type guard
function isExtractorPayload(p) {
const data = p && !Array.isArray(p) && typeof p === 'object' && 'data' in p ? p.data : p;
return Array.isArray(data);
} Try / catch
try {
await youdaoNote(url);
} catch (e) {
if (String(e.message).includes('malformed payload')) {
// retry once, then surface 'youdao page structure changed' to the operator
} else throw e;
} Prevention
- Retry transiently before treating it as a hard failure
- Run with a clean browser profile (no script-injecting extensions)
- Keep the CLI updated for Youdao page changes
- Log the raw evaluate payload for diagnosis
When it happens
Trigger: page.evaluate returning an object/string instead of the IIFE's array (browser extension interference, a page navigation replacing the document mid-evaluate, a wrapper runner returning its own envelope with an unexpected shape, or evaluate serializing a promise/error object).
Common situations: Youdao shipping a new page framework that breaks the injected script; headless browser plugins injecting scripts that alter evaluate return values; SPA re-render/navigation between goto and evaluate; automation runners that wrap evaluate results in custom envelopes unwrapEvaluateResult doesn't recognize.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Youdao note parser failed: ${reason}
- archive search returned malformed payload: result row is mis
- archive search returned malformed payload for "${id}": downl
- archive snapshots returned malformed CDX payload: missing "$
- 该聊天缺少 securityId,无法获取历史消息
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a8b755de12293db7.
Report an issue: GitHub.