{"record":{"id":"b90a4404924c478c","repo":"jackwener/OpenCLI","slug":"boss-candidate-search-b90a44","errorCode":null,"errorMessage":"boss candidate search","messagePattern":"boss candidate search","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/boss/send.js","lineNumber":29,"sourceCode":"    site: 'boss',\n    name: 'send',\n    access: 'write',\n    description: 'BOSS直聘发送聊天消息',\n    domain: 'www.zhipin.com',\n    strategy: Strategy.COOKIE,\n    navigateBefore: false,\n    browser: true,\n    args: [\n        { name: 'uid', positional: true, required: true, help: 'Encrypted UID of the candidate (from chatlist)' },\n        { name: 'text', required: true, positional: true, help: 'Message text to send' },\n    ],\n    columns: ['status', 'detail'],\n    func: async (page, kwargs) => {\n        requirePage(page);\n        await navigateToChat(page, 3);\n        const friend = await findFriendByUid(page, kwargs.uid, { maxPages: 5 });\n        if (!friend)\n            throw new EmptyResultError('boss candidate search', '请确认 uid 是否正确');\n        const numericUid = friend.uid;\n        const friendName = friend.name || '候选人';\n        const clicked = await clickCandidateInList(page, numericUid);\n        if (!clicked) {\n            throw selectorError('聊天列表中的用户', '请确认聊天列表中有此人');\n        }\n        await page.wait({ time: 2 });\n        const sent = await typeAndSendMessage(page, kwargs.text);\n        if (!sent) {\n            throw selectorError('消息输入框', '聊天页面 UI 可能已改变');\n        }\n        await page.wait({ time: 1 });\n        return [{ status: '✅ 发送成功', detail: `已向 ${friendName} 发送: ${kwargs.text}` }];\n    },\n});\n","sourceCodeStart":11,"sourceCodeEnd":45,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/send.js#L11-L45","documentation":"EmptyResultError raised by the boss send command when findFriendByUid cannot find any candidate matching kwargs.uid in the chat list after scanning up to 5 pages. The send flow aborts because it has no one to open a chat with.","triggerScenarios":"Calling boss send with an incorrect/typo'd uid, a uid for a candidate with no existing conversation, or a uid from a different account's data; chat list pagination exhausted without a match.","commonSituations":"Reusing uids cached from a previous session after conversations were deleted; hardcoding uids from another recruiter account; uid format changes from BOSS; searching while the chat list is filtered.","solutions":["Re-run candidate search / findFriendByUid to get a fresh, correct uid for this account","Confirm the candidate actually appears in this account's chat list (a conversation exists)","Increase maxPages beyond 5 if the candidate is deep in a long chat list","Clear stale uid caches and refetch","Log in with the correct account that owns the conversation"],"exampleFix":"// before\nawait cli('boss', 'send', { uid: cachedUid, message: 'hi' }); // stale uid\n// after\nconst friends = await findFriendByUid(page, candidateNameOrUid, { maxPages: 5 });\nif (!friends) throw new Error('candidate not in chat list; re-search candidates first');\nawait cli('boss', 'send', { uid: friends.uid, message: 'hi' });","handlingStrategy":"validation","validationCode":"const friend = await findFriendByUid(page, uid, { maxPages: 5 });\nif (!friend) throw new Error(`uid ${uid} not in chat list; refresh uids or increase maxPages`);","typeGuard":"function hasFriend(f) { return Boolean(f && f.uid && typeof f.uid === 'string'); }","tryCatchPattern":"try {\n  await cli('boss', 'send', { uid, message });\n} catch (e) {\n  if (e.name === 'EmptyResultError') {\n    await refreshChatList(page);\n    return cli('boss', 'send', { uid, message });\n  }\n  throw e;\n}","preventionTips":["Refetch uids from candidate search each session","Keep conversations active so candidates stay in the chat list","Raise maxPages for very long chat lists","Verify account identity matches the uid source"],"tags":["empty-result","uid-lookup","boss-zhipin"],"backgroundTag":"record-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}