{"record":{"id":"b1f0382da807d78a","repo":"jackwener/OpenCLI","slug":"boss-chatlist-returned-an-unexpected-response","errorCode":null,"errorMessage":"Boss chatlist returned an unexpected response","messagePattern":"Boss chatlist returned an unexpected response","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/boss/chatlist.js","lineNumber":114,"sourceCode":"        const bossResult = await fetchFriendList(page, {\n            pageNum,\n            jobId: kwargs['job-id'] || '0',\n            allowNonZero: true,\n        });\n        if (Array.isArray(bossResult)) {\n            if (bossResult.length === 0)\n                throw new EmptyResultError('boss chatlist', 'No recruiter-side chat sessions were returned.');\n            return bossResult.slice(0, limit).map(mapBossRow);\n        }\n        if (bossResult.code === IDENTITY_MISMATCH_CODE) {\n            await navigateToGeekChat(page);\n            const rows = await buildGeekRows(page, limit);\n            if (rows.length === 0)\n                throw new EmptyResultError('boss chatlist', 'No job-seeker-side chat sessions were returned.');\n            return rows;\n        }\n        assertOk(bossResult);\n        throw new CommandExecutionError('Boss chatlist returned an unexpected response');\n    },\n});\n","sourceCodeStart":96,"sourceCodeEnd":117,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/chatlist.js#L96-L117","documentation":"In auto mode, after handling the array case and the IDENTITY_MISMATCH_CODE case, any other non-conforming response shape from fetchFriendList that survives assertOk leads to this CommandExecutionError. It means the recruiter chat API returned a structured response the adapter cannot interpret — neither a friend array, nor a known mismatch code, nor a recognized ok response.","triggerScenarios":"fetchFriendList returns an object whose code is not IDENTITY_MISMATCH_CODE and which assertOk does not accept (unknown error code, new API envelope, {code:0} shape change, or a wrapped {data:...} without ok flag).","commonSituations":"zhipin.com changed its friend-list API response envelope; a new business error code appeared (rate limit, permission change); the anti-bot layer returned a JSON denial the adapter doesn't classify; adapter/utils.js out of date relative to the live API.","solutions":["Log the raw bossResult (add a temporary console.log before the throw) to see the actual code/payload","Update clis/boss/utils.js fetchFriendList/assertOk to recognize the new response code or envelope","Re-authenticate (boss login) in case the response is a disguised auth denial","Retry later if it is a rate-limit/anti-bot response, ideally with a different IP or slower polling"],"exampleFix":"// before\nassertOk(bossResult);\nthrow new CommandExecutionError('Boss chatlist returned an unexpected response');\n// after\nassertOk(bossResult);\nconsole.error('bossResult', JSON.stringify(bossResult));\nif (bossResult.code === NEW_RATE_LIMIT_CODE) return [];\nthrow new CommandExecutionError('Boss chatlist returned an unexpected response');","handlingStrategy":"try-catch","validationCode":"// Pre-flight: verify session and that the chat API is reachable\nconst identity = await bossVerify(page); // throws early on auth problems\n// then run chatlist expecting a known shape","typeGuard":"function isKnownBossResult(v) {\n  if (Array.isArray(v)) return true;\n  if (v === null || typeof v !== 'object') return false;\n  return typeof v.code === 'number' || v.ok === true;\n}","tryCatchPattern":"try {\n  rows = await bossChatlist({ side: 'auto' });\n} catch (err) {\n  if (err instanceof CommandExecutionError && err.message.includes('unexpected response')) {\n    // unknown API envelope: capture payload for the adapter maintainers\n    console.error('boss chatlist contract drift; raw result not exposed — inspect clis/boss/utils.js');\n    return []; // degrade gracefully in pipelines\n  }\n  throw err;\n}","preventionTips":["Log/inspect raw fetchFriendList payloads when extending the adapter so new codes are classified promptly","Keep assertOk updated with every zhipin.com business error code you encounter","Re-authenticate and retry with backoff when the API behaves anomalously (possible rate limiting)","Track zhipin.com web-app API changes; update clis/boss/utils.js before they break chatlist"],"tags":["unexpected-response","api-contract","chatlist","zhipin"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}