jackwener/OpenCLI · error
无法在聊天列表中找到该用户,候选人可能不在当前列表中
Error message
无法在聊天列表中找到该用户,候选人可能不在当前列表中
What it means
In `opencli boss greet`, after the candidate record is found, the command tries clickCandidateInList(numericUid) to actually open the chat. If the DOM click fails — the row is not rendered in the current chat list view even though the record was found — it throws '无法在聊天列表中找到该用户'. This separates 'found in data' from 'clickable in the UI'.
Source
Thrown at clis/boss/greet.js:38
],
columns: ['status', 'detail'],
func: async (page, kwargs) => {
requirePage(page);
verbose(`Greeting candidate ${kwargs.uid}...`);
await navigateToChat(page, 3);
// Find candidate in greet list or friend list
const friend = await findFriendByUid(page, kwargs.uid, {
maxPages: 1,
checkGreetList: true,
});
if (!friend) {
throw new Error('未找到该候选人,请确认 uid 是否正确(可从 recommend 命令获取)');
}
const numericUid = friend.uid;
const friendName = friend.name || '候选人';
const clicked = await clickCandidateInList(page, numericUid);
if (!clicked) {
throw new Error('无法在聊天列表中找到该用户,候选人可能不在当前列表中');
}
await page.wait({ time: 2 });
const msgText = kwargs.text || '你好,请问您对这个职位感兴趣吗?';
const sent = await typeAndSendMessage(page, msgText);
if (!sent) {
throw new Error('找不到消息输入框');
}
await page.wait({ time: 1 });
return [{ status: '✅ 招呼已发送', detail: `已向 ${friendName} 发送: ${msgText}` }];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command — the list may render the row after a refresh.
- Open the chat with the candidate manually in the browser once so a chat-list row exists, then retry.
- Retry shortly after `opencli boss recommend` so the candidate is at the top of the greet/chat list.
- Check for BOSS UI changes/filters (e.g. a list filter hiding the candidate) in the open browser session.
Example fix
// before opencli boss greet <uid> # greet-list-only candidate // after # initiate first contact from recommend flow, then: opencli boss greet <uid>
Defensive patterns
Strategy: retry
Validate before calling
// Check the candidate has a chat-list entry (not greet-list only) before greeting: // if `opencli boss resume <uid>` also fails with 未找到, there is no row to click yet. const hasChatEntry = await canFindInChatList(uid);
Try / catch
try {
await run(['opencli', 'boss', 'greet', uid, '--text', msg]);
} catch (e) {
if (e.message.includes('无法在聊天列表中找到该用户')) {
await sleep(2000); // let the chat list render
await run(['opencli', 'boss', 'greet', uid, '--text', msg]); // retry once
} else throw e;
} Prevention
- Retry once after a short delay — this is often a render timing issue.
- Establish a chat entry first (candidate must be chatted, not greet-only).
- Avoid list filters/sorting changes in the browser session between lookup and click.
- Keep the BOSS browser session logged in and idle-free.
When it happens
Trigger: findFriendByUid succeeded (e.g. from greet-list data) but the candidate's row is not present/rendered in the currently displayed chat list DOM, so clickCandidateInList returns false — e.g. greet-list-only entries not shown in chat list, list re-sorted between find and click, or virtualized list not rendering the row.
Common situations: Candidate exists only in the greet list (never chatted) so there is no chat-list row to click; UI list refreshed/filtered between lookup and click; slow rendering so the row wasn't mounted when the click ran.
Related errors
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/3a3f2a1bd155ae0c.
Report an issue: GitHub.