jackwener/OpenCLI · warning · EmptyResultError
未找到该候选人
Error message
未找到该候选人
What it means
bossChatMsg throws EmptyResultError('boss chatmsg', '未找到该候选人') when neither an existingFriend argument nor findFriendByUid resolves to a chat entry for the given uid. The library throws because it cannot obtain the gid/securityId needed to call the historyMsg API, so returning anything would fabricate data. It signals an empty lookup result, not a network failure.
Source
Thrown at clis/boss/chatmsg.js:41
time: m.time ? new Date(m.time).toLocaleString('zh-CN') : '',
};
}
function mapGeekMsg(m, friend) {
const fromUid = m.from && m.from.uid;
const isFromBoss = fromUid != null && String(fromUid) === String(friend.uid);
return {
from: isFromBoss ? '对方' : '我',
type: TYPE_MAP[m.type] || `其他(${m.type})`,
text: m.text || m.body?.text || m.body?.content || m.body?.showText ||
JSON.stringify(m.body || {}).slice(0, 120),
time: m.time ? new Date(m.time).toLocaleString('zh-CN') : '',
};
}
async function bossChatMsg(page, kwargs, existingFriend) {
const friend = existingFriend ?? await findFriendByUid(page, kwargs.uid);
if (!friend) throw new EmptyResultError('boss chatmsg', '未找到该候选人');
if (!friend.securityId) throw new CommandExecutionError('该聊天缺少 securityId,无法获取历史消息');
const gid = friend.uid;
const securityId = encodeURIComponent(friend.securityId);
const msgUrl = `https://www.zhipin.com/wapi/zpchat/boss/historyMsg?gid=${gid}&securityId=${securityId}&page=${kwargs.page}&c=20&src=0`;
const msgData = await bossFetch(page, msgUrl);
const messages = msgData.zpData?.messages ?? msgData.zpData?.historyMsgList;
if (!Array.isArray(messages)) {
throw new CommandExecutionError('Boss recruiter history response did not include a message list');
}
if (messages.length === 0) {
throw new EmptyResultError('boss chatmsg', 'Boss returned no messages for this chat.');
}
return messages.map((m) => mapBossMsg(m, friend));
}
async function geekChatMsg(page, kwargs, encryptSystemId) {
const friend = await findGeekFriendByUid(page, kwargs.uid, { encryptSystemId });
if (!friend) throw new EmptyResultError('boss chatmsg', '未找到该聊天(geek 侧)');View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run `opencli boss chatlist` and copy a fresh uid from its output; encrypted uids rotate.
- Omit --side (use default 'auto') so the command also searches the geek-side chat list before giving up.
- Verify the uid string is complete and unmodified (no truncation, quotes, or whitespace) — it must match the encrypted uid column exactly.
- Check you are logged into the correct recruiter account that actually has this conversation.
- If using side=geek/boss explicitly, confirm the uid exists on that specific side; switch --side accordingly.
Example fix
// before opencli boss chatmsg 0x8f3a2b --side boss // uid only exists on geek side // after opencli boss chatmsg 0x8f3a2b // auto mode finds it on the geek side
Defensive patterns
Strategy: try-catch
Validate before calling
// verify uid exists before fetching messages
const friends = await chatlist({});
const match = friends.find(f => f.uid === uid);
if (!match) throw new Error(`uid ${uid} not in current chatlist — refresh it`); Type guard
function isFriend(f) { return !!f && typeof f === 'object' && typeof f.uid === 'string' && f.uid.length > 0; } Try / catch
try {
const msgs = await chatmsg(uid, { side: 'auto' });
} catch (e) {
if (isEmptyResultError(e)) return []; // treat as no conversation
throw e;
} Prevention
- Always take uid values from a fresh `boss chatlist` run; encrypted uids are not stable across sessions.
- Prefer side=auto over forcing --side boss so both chat lists are searched.
- Quote uids in the shell to avoid character mangling.
- Verify the conversation exists in the BOSS web UI when debugging.
When it happens
Trigger: Calling `boss side=boss chatmsg <uid>` with a uid that is absent from the recruiter's chat list — e.g. a uid taken from the geek (job-seeker) side, a stale uid from an older chatlist run, a typo/truncated encrypted uid, or the conversation having been deleted by the candidate.
Common situations: Caching a uid from a previous session after the chat was removed; using a geek-side uid with --side boss; account switched and the new recruiter account has no such conversation; the candidate unmatched/blocked the recruiter so the chat disappeared.
Related errors
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a00e16cac0bbc88c.
Report an issue: GitHub.