{"record":{"id":"93a69f20652bdf88","repo":"jackwener/OpenCLI","slug":"selector-93a69f","errorCode":"SELECTOR","errorMessage":"Could not find element: 闲鱼聊天输入框","messagePattern":"Could not find element: 闲鱼聊天输入框","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/xianyu/reply.js","lineNumber":57,"sourceCode":"        const url = hasIds ? buildChatUrl(itemId, userId) : '';\n        if (hasIds) {\n            await page.goto(url);\n        } else {\n            if (!page.getCurrentUrl || !/https:\\/\\/www\\.goofish\\.com\\/im\\b/.test(await page.getCurrentUrl())) {\n                await page.goto('https://www.goofish.com/im');\n            }\n        }\n        await page.wait(2);\n        if (rank > 0) {\n            requireClickResult(await page.evaluate(buildClickInboxConversationEvaluate(rank - 1)), 'reply rank click');\n            await page.wait(2);\n        }\n        const state = requireEvaluateObject(await page.evaluate(buildExtractChatStateEvaluate()), 'reply');\n        if (state?.requiresAuth) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu reply requires a logged-in browser session');\n        }\n        if (!state?.can_input) {\n            throw selectorError('闲鱼聊天输入框', '未找到可用的聊天输入框，请确认该会话页已正确加载');\n        }\n        const sent = requireEvaluateObject(await page.evaluate(buildSendMessageEvaluate(text)), 'reply send');\n        if (!sent?.ok) {\n            throw new CommandExecutionError(`Xianyu reply did not observe the sent message: ${sent?.reason || 'unknown-reason'}`);\n        }\n        await page.wait(1);\n        return [{\n            status: 'sent',\n            peer_name: state.peer_name || '',\n            item_title: state.item_title || '',\n            price: state.price || '',\n            location: state.location || '',\n            message: text,\n            peer_user_id: userId,\n            item_id: itemId,\n            url: url || '',\n            item_url: state.item_url || '',\n        }];","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/reply.js#L39-L75","documentation":"selectorError thrown when the Xianyu reply flow's extracted chat state has can_input=false — no usable chat input box was found for the conversation. Like error 5431 but in the auto-reply (reply.js) flow.","triggerScenarios":"Running the xianyu reply command (clis/xianyu/reply.js) on a conversation page whose extracted state reports can_input false, so buildSendMessageEvaluate never runs.","commonSituations":"Conversation page still rendering when state was read; session degraded so the composer is disabled; the reply target page redirected to a non-chat view; DOM changes broke the extractor.","solutions":["Reload the conversation, wait for the composer to render, then retry","Verify the URL points to an open Xianyu chat conversation","Re-login to refresh a degraded session","Update buildExtractChatStateEvaluate selectors if the chat DOM changed"],"exampleFix":"// before\nawait opencli xianyu reply --id 123 --text hi\n// after: allow the page to settle first\nawait page.wait(5);\nawait opencli xianyu reply --id 123 --text hi","handlingStrategy":"validation","validationCode":"const state = JSON.parse(await page.evaluate(buildExtractChatStateEvaluate()));\nif (!state || state.requiresAuth) await xianyuLogin();\nif (!state.can_input) throw new Error('Reply target input not ready — reload the conversation');","typeGuard":"function canInput(state) { return Boolean(state && state.can_input === true); }","tryCatchPattern":"try {\n  await opencli xianyu reply --id 123 --text 'hi';\n} catch (e) {\n  if (e.code === 'SELECTOR' && e.message.includes('闲鱼聊天输入框')) {\n    await page.reload(); await page.wait(5);\n    await opencli xianyu reply --id 123 --text 'hi';\n  } else throw e;\n}","preventionTips":["Ensure the conversation page fully renders before replying","Verify the target id maps to a live conversation","Refresh sessions when the composer is disabled","Update extractors when the chat DOM changes"],"tags":["selector","dom","xianyu"],"backgroundTag":"selector-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}