{"record":{"id":"f8d2266cae89f7e1","repo":"jackwener/OpenCLI","slug":"boss-geek-history-response-did-not-include-a-messa","errorCode":null,"errorMessage":"Boss geek history response did not include a message list","messagePattern":"Boss geek history response did not include a message list","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/boss/utils.js","lineNumber":472,"sourceCode":"        String(f.uid) === String(encryptUid) ||\n        String(f.friendId) === String(encryptUid));\n    if (!candidate) return null;\n    const enriched = await fetchGeekFriendInfoList(page, [candidate.friendId]);\n    return { ...candidate, ...(enriched[0] || {}) };\n}\n/**\n * Fetch message history for a geek-side chat.\n * friend must have .uid (boss's numeric id) and .securityId.\n */\nexport async function fetchGeekHistoryMsg(page, friend, opts = {}) {\n    const pageNum = opts.page ?? 1;\n    const bossId = friend.uid;\n    const securityId = encodeURIComponent(friend.securityId || '');\n    const url = `https://${BOSS_DOMAIN}/wapi/zpchat/geek/historyMsg?bossId=${bossId}&securityId=${securityId}&page=${pageNum}&c=20&src=0`;\n    const data = await bossFetch(page, url);\n    const messages = data.zpData?.messages ?? data.zpData?.historyMsgList;\n    if (!Array.isArray(messages)) {\n        throw new CommandExecutionError('Boss geek history response did not include a message list');\n    }\n    if (messages.length === 0) {\n        throw new EmptyResultError('boss chatmsg', 'Boss returned no messages for this chat.');\n    }\n    return messages;\n}\n","sourceCodeStart":454,"sourceCodeEnd":479,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/utils.js#L454-L479","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Refresh the friend object (re-fetch friend list) to get a current securityId, then retry messages","Re-login to Boss直聘 and retry","Log the full response body at the throw site to see which envelope Boss actually returned","Add the new field name to the fallback chain if Boss renamed the list key"],"exampleFix":"// before\nconst messages = data.zpData?.messages ?? data.zpData?.historyMsgList;\n// after\nconst messages = data.zpData?.messages ?? data.zpData?.historyMsgList ?? data.zpData?.msgList;","handlingStrategy":"type-guard","validationCode":"if (!friend?.uid || !friend?.securityId) throw new Error('Friend object missing uid/securityId — refresh friend list first');","typeGuard":"function hasMessageList(d) { return Array.isArray(d?.zpData?.messages) || Array.isArray(d?.zpData?.historyMsgList); }","tryCatchPattern":"try { const msgs = await fetchGeekHistoryMsg(page, friend, pageNum); }\ncatch (e) {\n  if (e instanceof CommandExecutionError) { friend = await refreshFriend(page, friend.uid); return fetchGeekHistoryMsg(page, friend, pageNum); }\n  throw e;\n}","preventionTips":["Always source friend objects from a fresh friend-list fetch, not cached data","Handle both messages and historyMsgList field names if you parse responses yourself","Re-login when consecutive chat-history calls fail","Log raw responses to detect A/B schema changes"],"tags":["boss-zhipin","api-response","chat-history","missing-field"],"backgroundTag":"api-response-missing-field","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}