{"record":{"id":"bdd0b1e6589db3d1","repo":"jackwener/OpenCLI","slug":"error-bdd0b1","errorCode":null,"errorMessage":"未找到该候选人","messagePattern":"未找到该候选人","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clis/boss/exchange.js","lineNumber":27,"sourceCode":"    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', required: true, positional: true, help: 'Encrypted UID of the candidate' },\n        { name: 'type', default: 'phone', choices: ['phone', 'wechat'], help: 'Exchange type: phone or wechat' },\n    ],\n    columns: ['status', 'detail'],\n    func: async (page, kwargs) => {\n        requirePage(page);\n        const exchangeType = kwargs.type || 'phone';\n        verbose(`Requesting ${exchangeType} exchange for ${kwargs.uid}...`);\n        await navigateToChat(page);\n        const friend = await findFriendByUid(page, kwargs.uid, { checkGreetList: true });\n        if (!friend)\n            throw new Error('未找到该候选人');\n        const friendName = friend.name || '候选人';\n        const typeId = exchangeType === 'wechat' ? 2 : 1;\n        const params = new URLSearchParams({\n            type: String(typeId),\n            securityId: friend.securityId || '',\n            uniqueId: String(friend.uid),\n            name: friendName,\n        });\n        await bossFetch(page, 'https://www.zhipin.com/wapi/zpchat/exchange/request', {\n            method: 'POST',\n            body: params.toString(),\n        });\n        const typeLabel = exchangeType === 'wechat' ? '微信' : '手机号';\n        return [{\n                status: '✅ 交换请求已发送',\n                detail: `已向 ${friendName} 发送${typeLabel}交换请求`,\n            }];\n    },","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/exchange.js#L9-L45","documentation":"`opencli boss exchange` requests a phone/wechat contact exchange by first locating the candidate via findFriendByUid in the chat list and greet list. If no candidate with the given uid exists there, the command throws '未找到该候选人' (candidate not found). The uid must correspond to a candidate already visible in the boss's chat/greet lists.","triggerScenarios":"Calling `opencli boss exchange <uid>` where the uid is wrong/encrypted-expired, the candidate was never greeted (not in greet list), the chat list has been archived/deleted, or pagination of the chat list did not reach the candidate.","commonSituations":"Using a uid captured long ago after the chat was deleted or archived; typo in uid; candidate only appears deeper in the list than findFriendByUid scans; BOSS session state differs from when the uid was collected.","solutions":["Get a fresh uid from `opencli boss recommend` (greet list) and retry.","Confirm the candidate actually appears in the BOSS chat/greet list in the browser; re-greet if necessary.","Retry with an active BOSS login session — stale sessions can truncate the friend list.","Check the uid for typos or truncation from copy-paste."],"exampleFix":"// before\nopencli boss exchange 8f3a...stale\n// after\nopencli boss recommend   # get fresh uid\nopencli boss exchange <fresh-uid>","handlingStrategy":"try-catch","validationCode":"const uid = args.uid;\nif (!uid || typeof uid !== 'string' || uid.length < 8) {\n  throw new Error('uid looks invalid; get a fresh one from `opencli boss recommend`.');\n}","typeGuard":"function isValidUid(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  await run(['opencli', 'boss', 'exchange', uid, '--type', 'phone']);\n} catch (e) {\n  if (e.message.includes('未找到该候选人')) {\n    console.error('Candidate not in chat/greet list; fetch fresh uid via `opencli boss recommend`.');\n  }\n  throw e;\n}","preventionTips":["Always source uids from a fresh `recommend` run in the same session.","Verify the candidate is visible in the chat/greet list before exchanging.","Check uid strings for copy-paste truncation.","Avoid reusing uids across sessions or after deleting chats."],"tags":["candidate-not-found","boss","chat-list"],"backgroundTag":"entity-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}