jackwener/OpenCLI · error · CommandExecutionError
Xianyu publish form fill failed; missing fields: ${missing}
Error message
Xianyu publish form fill failed; missing fields: ${missing} What it means
After buildFillFormEvaluate(data) runs in the page, a falsy ok result throws CommandExecutionError listing the missing fields (fillResult.missing joined, or 'unknown'). It means one or more form fields (title/description/price/etc.) could not be filled on the goofish publish form.
Source
Thrown at clis/xianyu/publish.js:413
if (initState?.requiresAuth) {
throw new AuthRequiredError('www.goofish.com', '发布闲鱼需要先登录,请在 Chrome 中打开 goofish.com 并完成登录');
}
if (!initState?.hasPublishForm) {
throw new CommandExecutionError('Xianyu publish form was not detected', 'Confirm goofish.com is logged in and the publish page finished loading.');
}
// 3. 选择分类(先于其他字段,因为分类可能影响表单结构)
const categoryResult = await page.evaluate(buildSelectCategoryEvaluate(data.category));
if (!categoryResult?.ok) {
throw new CommandExecutionError(`Xianyu category selection failed: ${categoryResult?.reason || 'unknown-reason'}`);
}
await page.wait(1.5);
// 4. 填充表单
const fillResult = await page.evaluate(buildFillFormEvaluate(data));
if (!fillResult?.ok) {
const missing = Array.isArray(fillResult?.missing) ? fillResult.missing.join(', ') : 'unknown';
throw new CommandExecutionError(`Xianyu publish form fill failed; missing fields: ${missing}`);
}
await page.wait(1);
// 5. 上传图片(如果有)
if (data.images.length > 0) {
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}`);
}View on GitHub (pinned to 49907e53dc)
Solutions
- Check the listed missing field names and confirm the corresponding data values are non-empty and valid
- Increase the wait before filling so all inputs are mounted
- Retry once — transient render timing often resolves on a second run
- Update buildFillFormEvaluate selectors to match the current goofish DOM
Example fix
// before
await publish({ title: '', description: 'desc', price: '10' });
// after
await publish({ title: 'iPhone 13 128G', description: 'desc', price: '10' }); Defensive patterns
Strategy: try-catch
Validate before calling
for (const f of ['title', 'description', 'price']) {
if (data[f] == null || String(data[f]).trim() === '') {
throw new Error(`Field "${f}" is required before publish`);
}
} Type guard
function isFillableListing(d) {
return Boolean(d && typeof d.title === 'string' && d.title.trim()
&& typeof d.description === 'string' && d.description.trim()
&& d.price != null);
} Try / catch
try {
await publish(data);
} catch (e) {
if (e instanceof CommandExecutionError && /form fill failed/.test(e.message)) {
const missing = e.message.match(/fields: (.+)$/)?.[1] ?? 'unknown';
console.error(`Refill needed for: ${missing}`);
await sleep(2000);
await publish(data);
} else throw e;
} Prevention
- Ensure all required listing fields are non-empty before publishing
- Log fillResult.missing to target exactly which fields the DOM lacked
- Wait for the form to fully mount before filling; retry once on transient render timing
When it happens
Trigger: buildFillFormEvaluate returns { ok: false, missing: [...] } when inputs for specific fields are absent from the DOM or could not receive values — missing title/description/price inputs, changed selectors, or fields disabled until other steps complete.
Common situations: goofish frontend redesign renaming input elements, page not fully rendered before fill, required fields conditionally shown, or values rejected by the form's own validation leaving them 'missing'.
Related errors
- Failed to extract Booking.com cards: ${err?.message || err}
- coupang add-to-cart evaluation failed: ${error?.message || e
- coupang search
- coupang search extraction failed: ${error?.message || error}
- Ctrip cruise port page did not render (state=${String(portWa
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/599c2b10a73eb0bc.
Report an issue: GitHub.