jackwener/OpenCLI · error · CliError
SELECTOR
SELECTOR
Error message
Could not find element: 闲鱼聊天输入框
What it means
selectorError thrown when the Xianyu chat page state extraction succeeds but reports can_input=false — no usable chat input box exists. The library treats this as 'element not found' for the 闲鱼聊天输入框 (chat input) element.
Source
Thrown at clis/xianyu/chat.js:33
args: [
{ name: 'item_id', required: true, positional: true, help: '闲鱼商品 item_id' },
{ name: 'user_id', required: true, positional: true, help: '聊一聊对方的 user_id / peerUserId' },
{ name: 'text', help: 'Message to send after opening the chat' },
],
columns: ['status', 'peer_name', 'item_title', 'price', 'location', 'message'],
func: async (page, kwargs) => {
const itemId = normalizeNumericId(kwargs.item_id, 'item_id', '1038951278192');
const userId = normalizeNumericId(kwargs.user_id, 'user_id', '3650092411');
const url = buildChatUrl(itemId, userId);
const text = String(kwargs.text || '').trim();
await page.goto(url);
await page.wait(2);
const state = requireEvaluateObject(await page.evaluate(buildExtractChatStateEvaluate()), 'chat');
if (state?.requiresAuth) {
throw new AuthRequiredError('www.goofish.com', 'Xianyu chat requires a logged-in browser session');
}
if (!state?.can_input) {
throw selectorError('闲鱼聊天输入框', '未找到可用的聊天输入框,请确认该会话页已正确加载');
}
if (!text) {
return [{
status: 'ready',
peer_name: state.peer_name || '',
item_title: state.item_title || '',
price: state.price || '',
location: state.location || '',
message: (state.visible_messages || []).slice(-1)[0] || '',
peer_user_id: userId,
item_id: itemId,
url,
item_url: state.item_url || '',
}];
}
const sent = requireEvaluateObject(await page.evaluate(buildSendMessageEvaluate(text)), 'chat send');
if (!sent?.ok) {
throw new CommandExecutionError(`Xianyu chat did not observe the sent message: ${sent?.reason || 'unknown-reason'}`);View on GitHub (pinned to 49907e53dc)
Solutions
- Reload the conversation page and wait longer for it to render, then retry
- Confirm the URL is an actual Xianyu chat conversation page, not a list or redirect target
- Re-login if the session is stale (auth was already checked, but degraded sessions can hide the input)
- Update buildExtractChatStateEvaluate selectors if Goofish changed their chat DOM
Example fix
// before: immediate call after navigation await opencli xianyu chat --id 123 --text hi // after: ensure page settled await page.reload(); await page.wait(5); await opencli xianyu chat --id 123 --text hi
Defensive patterns
Strategy: validation
Validate before calling
const state = JSON.parse(await page.evaluate(buildExtractChatStateEvaluate()));
if (!state || state.requiresAuth) await xianyuLogin();
if (!state.can_input) throw new Error('Chat input not ready — reload the conversation page'); Type guard
function canInput(state) { return Boolean(state && state.can_input === true); } Try / catch
try {
await opencli xianyu chat --id 123 --text 'hi';
} catch (e) {
if (e.code === 'SELECTOR' && e.message.includes('闲鱼聊天输入框')) {
await page.reload(); await page.wait(5);
await opencli xianyu chat --id 123 --text 'hi';
} else throw e;
} Prevention
- Wait for the composer to render before sending text
- Confirm the URL is an open conversation page
- Keep chat-state extractors updated with Goofish DOM changes
- Re-login when sessions degrade
When it happens
Trigger: Running the xianyu chat command (clis/xianyu/chat.js) on a session page where the extracted chat state has can_input false — the page loaded but no interactable input was found.
Common situations: Chat page not fully loaded after the 2s wait; the conversation view failed to render; Xianyu DOM changed and the state extractor no longer matches the input element; user is on a wrong/redirected page.
Related errors
- SELECTOR
- Could not find Antigravity input box
- Could not find input box
- Could not find antigravity.agentSidePanelInputBox
- Could not find Antigravity input box
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/af8e8e91beb31dcd.
Report an issue: GitHub.