jackwener/OpenCLI · error · Error
Could not trigger "${actionLabels[0]}" action${viaClause}${e
Error message
Could not trigger "${actionLabels[0]}" action${viaClause}${errorClause}${lastMethodClause}. Debug screenshot: /tmp/xhs_publish_submit_debug.png What it means
Step 7 of the publish flow tries multiple methods to click the submit/发布 (or 暂存) button. If every invocation method fails, invokeResult.ok is false and the CLI throws with diagnostics: which label it looked for, the via strategy, the per-method error, and the last method's error, plus a debug screenshot.
Source
Thrown at clis/xiaohongshu/publish.js:1406
const text = (el.innerText || el.textContent || '').trim();
if (text && markers.some(marker => text.includes(marker))) return true;
}
return false;
}
`);
if (autoSaved) {
invokeResult.ok = true;
invokeResult.via = 'auto-save';
}
}
}
}
if (!invokeResult?.ok) {
await page.screenshot({ path: '/tmp/xhs_publish_submit_debug.png' });
const viaClause = invokeResult?.via ? ` (via=${invokeResult.via})` : '';
const errorClause = invokeResult?.error ? `, error=${invokeResult.error}` : '';
const lastMethodClause = invokeResult?.lastMethodError ? `, lastMethodError=${invokeResult.lastMethodError}` : '';
throw new Error(`Could not trigger "${actionLabels[0]}" action${viaClause}${errorClause}${lastMethodClause}. ` +
'Debug screenshot: /tmp/xhs_publish_submit_debug.png');
}
// ── Step 8: Verify success ─────────────────────────────────────────────────
await page.wait({ time: 4 });
const finalUrl = await page.evaluate('() => location.href');
const successMarkers = isDraft
? ['草稿已保存', '暂存成功', '保存成功', '保存于', '图文笔记(']
: ['发布成功', '上传成功'];
const successMsg = await page.evaluate(`
(markers => {
for (const el of document.querySelectorAll('*')) {
if (el.tagName === 'STYLE' || el.tagName === 'SCRIPT') continue;
const text = (el.innerText || '').trim();
if (text.length > 200) continue;
if (el.children.length === 0 && markers.some(marker => text.includes(marker))) return text;
}
return '';
})(${JSON.stringify(successMarkers)})View on GitHub (pinned to 49907e53dc)
Solutions
- Read viaClause/errorClause/lastMethodClause in the message and inspect /tmp/xhs_publish_submit_debug.png.
- Fix any form validation problems (empty description, no cover) that keep the button disabled.
- Retry — late rendering or transient overlays often resolve on a second attempt.
- Re-capture login if the screenshot shows a captcha/verification dialog; otherwise update the CLI for button-text/DOM changes.
Defensive patterns
Strategy: retry
Validate before calling
// validate inputs the submit button depends on
if (!title || !title.trim()) throw new Error('title required before publish');
if (!description || !description.trim()) throw new Error('description required before publish'); Try / catch
try {
await publish(opts);
} catch (e) {
if (String(e.message).startsWith('Could not trigger')) {
console.error('Inspect /tmp/xhs_publish_submit_debug.png:', e.message);
await sleep(3000);
return publish(opts); // retry once
}
throw e;
} Prevention
- Ensure all required composer fields (title, description, cover) are provided so the submit button is enabled.
- Read via/error/lastMethodError clauses in the message to identify which click strategy failed.
- Inspect /tmp/xhs_publish_submit_debug.png for overlays or captchas.
- Keep the CLI updated when xiaohongshu renames the 发布/暂存 button.
When it happens
Trigger: The submit button could not be found or clicked by any strategy — button text differs from actionLabels[0], the button is disabled, covered by a dialog, or the click dispatch was rejected by the page.
Common situations: Required fields missing/invalid so the button stays disabled, an overlay (emoji panel, dialog, captcha) intercepts clicks, xiaohongshu renamed the button (e.g. different 发布 wording), or page hadn't finished rendering.
Related errors
- Still on the video publish page after trying to select 图文. D
- Editing form did not appear after image acquisition. The pag
- data.err
- xiaohongshu creator-note-detail: signed API ${suffix} return
- xiaohongshu creator-note-detail: failed to read signed datac
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e4443976e7c9d45b.
Report an issue: GitHub.