jackwener/OpenCLI · error · CommandExecutionError

Boss geek history response did not include a message list

Error message

Boss geek history response did not include a message list

What it means

fetchGeekHistoryMsg fetches a chat's message history via geek/historyMsg and accepts either zpData.messages or zpData.historyMsgList. If neither is an array the response is not a valid history payload (auth expiry, empty/securityId mismatch, schema change), so the library throws this CommandExecutionError.

Source

Thrown at clis/boss/utils.js:472

        String(f.uid) === String(encryptUid) ||
        String(f.friendId) === String(encryptUid));
    if (!candidate) return null;
    const enriched = await fetchGeekFriendInfoList(page, [candidate.friendId]);
    return { ...candidate, ...(enriched[0] || {}) };
}
/**
 * Fetch message history for a geek-side chat.
 * friend must have .uid (boss's numeric id) and .securityId.
 */
export async function fetchGeekHistoryMsg(page, friend, opts = {}) {
    const pageNum = opts.page ?? 1;
    const bossId = friend.uid;
    const securityId = encodeURIComponent(friend.securityId || '');
    const url = `https://${BOSS_DOMAIN}/wapi/zpchat/geek/historyMsg?bossId=${bossId}&securityId=${securityId}&page=${pageNum}&c=20&src=0`;
    const data = await bossFetch(page, url);
    const messages = data.zpData?.messages ?? data.zpData?.historyMsgList;
    if (!Array.isArray(messages)) {
        throw new CommandExecutionError('Boss geek 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;
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Refresh the friend object (re-fetch friend list) to get a current securityId, then retry messages
  2. Re-login to Boss直聘 and retry
  3. Log the full response body at the throw site to see which envelope Boss actually returned
  4. Add the new field name to the fallback chain if Boss renamed the list key

Example fix

// before
const messages = data.zpData?.messages ?? data.zpData?.historyMsgList;
// after
const messages = data.zpData?.messages ?? data.zpData?.historyMsgList ?? data.zpData?.msgList;
Defensive patterns

Strategy: type-guard

Validate before calling

if (!friend?.uid || !friend?.securityId) throw new Error('Friend object missing uid/securityId — refresh friend list first');

Type guard

function hasMessageList(d) { return Array.isArray(d?.zpData?.messages) || Array.isArray(d?.zpData?.historyMsgList); }

Try / catch

try { const msgs = await fetchGeekHistoryMsg(page, friend, pageNum); }
catch (e) {
  if (e instanceof CommandExecutionError) { friend = await refreshFriend(page, friend.uid); return fetchGeekHistoryMsg(page, friend, pageNum); }
  throw e;
}

Prevention

When it happens

Trigger: Calling messages for a friend whose historyMsg request returns no messages array — session expired, wrong/missing securityId, chat with no accessible history endpoint shape, or Boss API schema change.

Common situations: Stale friend objects with outdated securityId; cookie expiry during long message-export runs; Boss A/B test renaming both known fields; anti-bot blocking the chat endpoint.

Related errors


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