jackwener/OpenCLI · warning · EmptyResultError

未找到该聊天(geek 侧)

Error message

未找到该聊天(geek 侧)

What it means

geekChatMsg throws EmptyResultError('boss chatmsg', '未找到该聊天(geek 侧)') when findGeekFriendByUid cannot locate the uid in the job-seeker's (geek) chat list. The library throws because it needs the geek-side friend record (securityId) to fetch history; with no match it returns nothing rather than guessing. Side-specific variant of the candidate-not-found error.

Source

Thrown at clis/boss/chatmsg.js:59

    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 侧)');
    if (!friend.securityId) throw new CommandExecutionError('该聊天缺少 securityId,无法获取历史消息');
    const messages = await fetchGeekHistoryMsg(page, friend, { page: kwargs.page });
    return messages.map((m) => mapGeekMsg(m, friend));
}

cli({
    site: 'boss',
    name: 'chatmsg',
    access: 'read',
    description: 'BOSS直聘查看聊天消息历史(招聘端/求职端)',
    domain: 'www.zhipin.com',
    strategy: Strategy.COOKIE,
    navigateBefore: false,
    browser: true,
    args: [
        { name: 'uid', required: true, positional: true, help: 'Encrypted UID (from chatlist)' },
        { name: 'page', type: 'int', default: 1, help: 'Page number' },
        { name: 'side', default: 'auto', choices: ['auto', 'boss', 'geek'], help: 'Identity side: auto (default), boss (recruiter), or geek (job-seeker)' },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run without --side (auto): the command tries the recruiter side first and only falls back to geek.
  2. Re-run `opencli boss chatlist` for the geek account and use a uid from that output.
  3. Confirm the geek account is logged in and the conversation still exists in the BOSS web UI.
  4. Verify the uid string is the full encrypted value from chatlist (no truncation or whitespace).
  5. If you meant the recruiter side, use --side boss instead.

Example fix

// before
opencli boss chatmsg 0x91fe --side geek
// after
opencli boss chatmsg 0x91fe   // auto: boss side first, geek fallback
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm the uid exists on the geek side before forcing --side geek
const geekList = await chatlist({ side: 'geek' });
if (!geekList.some(f => f.uid === uid)) throw new Error('uid not on geek side');

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: 'geek' });
} catch (e) {
  if (isEmptyResultError(e)) return chatmsg(uid, { side: 'auto' }); // search boss side too
  throw e;
}

Prevention

When it happens

Trigger: Calling `boss chatmsg <uid> --side geek` where the uid exists only on the recruiter (boss) side or not at all; the conversation was deleted from the job-seeker account; the encrypted uid belongs to a different account.

Common situations: Forcing --side geek for a recruiter-owned conversation; uid copied from a boss-side chatlist run; job-seeker account not logged in or switched, so the list is empty; conversation expired/archived on the geek side.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/0943c405dd2042ee. Report an issue: GitHub.