jackwener/OpenCLI · error · CommandExecutionError
Xianyu publish submit failed: ${submitResult?.reason || 'unk
Error message
Xianyu publish submit failed: ${submitResult?.reason || 'unknown-reason'} What it means
After filling the form and uploading images, publish evaluates buildSubmitEvaluate() to click the publish (发布) button. If the injected script returns ok:false — button not found, disabled, or the click failed — the CLI throws with the script's reason. Publishing never got initiated.
Source
Thrown at clis/xianyu/publish.js:437
if (!page.setFileInput) {
throw new CommandExecutionError('Xianyu publish requires Browser Bridge file upload support', 'Use a browser mode that supports setFileInput.');
}
const fileInput = await page.evaluate(buildFindFileInputSelectorEvaluate());
if (!fileInput?.ok) {
throw new CommandExecutionError(`Xianyu image upload input was not found: ${fileInput?.reason || 'unknown-reason'}`);
}
try {
await page.setFileInput(data.images, fileInput.selector || 'input[type="file"]');
await page.wait(3); // 等待图片上传处理
} catch (err) {
throw new CommandExecutionError(`Xianyu image upload failed: ${err?.message || err}`);
}
}
// 6. 点击发布按钮
const submitResult = await page.evaluate(buildSubmitEvaluate());
if (!submitResult?.ok) {
throw new CommandExecutionError(`Xianyu publish submit failed: ${submitResult?.reason || 'unknown-reason'}`);
}
// 7. 等待发布结果(最多 15 秒轮询)
await page.wait(2);
let itemId = '';
let finalUrl = await getCurrentPageUrl(page);
let failReason = '';
for (let i = 0; i < 10; i++) {
await page.wait(1.5);
const result = await page.evaluate(buildDetectSuccessEvaluate());
finalUrl = await getCurrentPageUrl(page);
if (result?.status === 'published') {
itemId = String(result.item_id || '').replace(/\D/g, '');
return [{
status: 'published',
item_id: itemId,View on GitHub (pinned to 49907e53dc)
Solutions
- Read `reason` from the message; if it says the button was disabled/missing, check the form state in the browser and fix field values.
- Retry after increasing the post-fill/post-upload waits so the page settles before clicking submit.
- Verify you are not on a login/captcha interstitial; re-authenticate if so.
- If goofish changed its DOM, update buildSubmitEvaluate selectors.
Example fix
// before const submitResult = await page.evaluate(buildSubmitEvaluate()); // after: give uploads time to finish before submitting await page.wait(3); const submitResult = await page.evaluate(buildSubmitEvaluate());
Defensive patterns
Strategy: retry
Validate before calling
// confirm the publish button is present and enabled before submitting
const ready = await page.evaluate(() => {
const b = [...document.querySelectorAll('button')].find((x) => /发布|publish/i.test(x.textContent || ''));
return !!b && !b.disabled;
}); Try / catch
try {
await publish(data);
} catch (e) {
if (String(e.message).includes('publish submit failed')) {
await page.wait(3); // let validation/uploads settle
return publish(data); // single retry
}
throw e;
} Prevention
- Fill all required fields with valid values so the submit button stays enabled.
- Wait for image uploads to finish before submitting in custom flows.
- Check for login/captcha interstitials before publishing.
- Re-verify submit-button selectors after goofish UI updates.
When it happens
Trigger: `xianyu publish` reaching step 6 where buildSubmitEvaluate returns ok:false: the submit button selector changed, the button is disabled because a required field failed validation, or a risk-control overlay blocks the click.
Common situations: Goofish UI update moving/renaming the publish button; form has client-side validation errors (e.g. price/title invalid) keeping the button disabled; an anti-bot dialog intercepting interaction; images still uploading when submit is attempted.
Related errors
- Xianyu image upload input was not found: ${fileInput?.reason
- Waiting for 12306 tk auth cookie
- ChatGPT composer is not available on the current page.
- Could not find the ChatGPT model selector in the composer.
- Could not click the ChatGPT ${target.label} model option.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c0b0ae29770c542a.
Report an issue: GitHub.