jackwener/OpenCLI · error · CommandExecutionError
Failed to fill summary
Error message
Failed to fill summary
What it means
This CommandExecutionError is thrown when the optional summary (digest) step fails: fillField(page, 'textarea#js_description', ...) returned a non-ok result, meaning the summary textarea was not found in the editor DOM. As with the other fill errors, fillField only reports 'field not found'; the command wraps it in this error. It runs only when kwargs.summary was provided.
Source
Thrown at clis/weixin/create-draft.js:316
if (!titleResult?.ok) throw new CommandExecutionError('Failed to fill title');
if (kwargs.author) {
const authorResult = await fillField(page, 'input#author', kwargs.author);
if (!authorResult?.ok) throw new CommandExecutionError('Failed to fill author');
}
const contentResult = await fillContent(page, kwargs.content);
if (!contentResult?.ok) throw new CommandExecutionError('Failed to fill content');
if (coverImage) {
await uploadContentImage(page, coverImage);
const coverSet = await selectCoverFromContent(page);
if (coverSet !== true) {
throw new CommandExecutionError('WeChat uploaded the image but did not confirm it as the draft cover.');
}
}
if (kwargs.summary) {
const summaryResult = await fillField(page, 'textarea#js_description', kwargs.summary);
if (!summaryResult?.ok) throw new CommandExecutionError('Failed to fill summary');
}
await saveDraft(page);
return [{
status: 'draft saved',
detail: `"${kwargs.title}"${kwargs.author ? ` by ${kwargs.author}` : ''}${coverImage ? ' (with cover)' : ''}`,
}];
} catch (error) {
if (error instanceof CliError) throw error;
const message = error instanceof Error ? error.message : String(error);
throw new CommandExecutionError(`WeChat create-draft failed: ${message}`);
}
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command — transient render timing past fixed waits is the most common cause.
- Inspect the live editor for the digest field's current id/structure and update the 'textarea#js_description' selector in clis/weixin/create-draft.js.
- Add an explicit wait (or a click to expand the summary section) for textarea#js_description before calling fillField.
- Omit --summary temporarily to complete draft creation, then set the digest manually in the WeChat UI.
Example fix
// before
const summaryResult = await fillField(page, 'textarea#js_description', kwargs.summary);
if (!summaryResult?.ok) throw new CommandExecutionError('Failed to fill summary');
// after
await page.waitForSelector('textarea#js_description', { timeout: 10000 }).catch(() => {});
const summaryResult = await fillField(page, 'textarea#js_description', kwargs.summary);
if (!summaryResult?.ok) throw new CommandExecutionError('Failed to fill summary: ' + (summaryResult?.reason ?? 'unknown')); Defensive patterns
Strategy: fallback
Validate before calling
const hasSummary = await page.evaluate('!!document.querySelector("textarea#js_description")');
if (kwargs.summary && hasSummary !== true) console.warn('Summary field missing; draft will be created without a digest.'); Try / catch
try {
await createDraft({ title, content, summary });
} catch (e) {
if (e instanceof CommandExecutionError && /Failed to fill summary/.test(e.message)) {
// degrade: retry without summary, or set the digest manually in the WeChat UI
} else throw e;
} Prevention
- Treat summary as optional and omit it when the digest field is known to be missing or relocated.
- Confirm the digest textarea id (js_description) after any WeChat editor update.
- Retry once — the field may render after the fixed waits.
- If the digest sits in a collapsed section, expand it (or wait for the selector) before filling.
When it happens
Trigger: Running create-draft with --summary while textarea#js_description is absent: WeChat changed the digest field's id, the summary field renders only after certain editor states (e.g., after save or in an expandable section) and the script does not wait for it, or the page served is a variant layout without that id.
Common situations: WeChat renames the digest input during an editor redesign; the summary field appears in a collapsed '摘要' section that requires a click to reveal; slow rendering past the fixed waits; account-level feature flags serving an editor without the classic digest textarea.
Related errors
- Failed to fill title
- Failed to fill author
- Failed to fill content
- Could not find ${fieldName} input. Debug screenshot: /tmp/xh
- Instagram reel upload failed
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e4c5baa5025c1342.
Report an issue: GitHub.