jackwener/OpenCLI · error
未找到该候选人
Error message
未找到该候选人
What it means
`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.
Source
Thrown at clis/boss/exchange.js:27
access: 'write',
description: 'BOSS直聘交换联系方式(请求手机/微信)',
domain: 'www.zhipin.com',
strategy: Strategy.COOKIE,
navigateBefore: false,
browser: true,
args: [
{ name: 'uid', required: true, positional: true, help: 'Encrypted UID of the candidate' },
{ name: 'type', default: 'phone', choices: ['phone', 'wechat'], help: 'Exchange type: phone or wechat' },
],
columns: ['status', 'detail'],
func: async (page, kwargs) => {
requirePage(page);
const exchangeType = kwargs.type || 'phone';
verbose(`Requesting ${exchangeType} exchange for ${kwargs.uid}...`);
await navigateToChat(page);
const friend = await findFriendByUid(page, kwargs.uid, { checkGreetList: true });
if (!friend)
throw new Error('未找到该候选人');
const friendName = friend.name || '候选人';
const typeId = exchangeType === 'wechat' ? 2 : 1;
const params = new URLSearchParams({
type: String(typeId),
securityId: friend.securityId || '',
uniqueId: String(friend.uid),
name: friendName,
});
await bossFetch(page, 'https://www.zhipin.com/wapi/zpchat/exchange/request', {
method: 'POST',
body: params.toString(),
});
const typeLabel = exchangeType === 'wechat' ? '微信' : '手机号';
return [{
status: '✅ 交换请求已发送',
detail: `已向 ${friendName} 发送${typeLabel}交换请求`,
}];
},View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before opencli boss exchange 8f3a...stale // after opencli boss recommend # get fresh uid opencli boss exchange <fresh-uid>
Defensive patterns
Strategy: try-catch
Validate before calling
const uid = args.uid;
if (!uid || typeof uid !== 'string' || uid.length < 8) {
throw new Error('uid looks invalid; get a fresh one from `opencli boss recommend`.');
} Type guard
function isValidUid(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
await run(['opencli', 'boss', 'exchange', uid, '--type', 'phone']);
} catch (e) {
if (e.message.includes('未找到该候选人')) {
console.error('Candidate not in chat/greet list; fetch fresh uid via `opencli boss recommend`.');
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- 未找到该候选人,请确认 uid 是否正确(可从 recommend 命令获取)
- 未找到该候选人
- boss candidate search
- 未找到该候选人,请确认 uid 是否正确
- 无法在聊天列表中找到该用户,候选人可能不在当前列表中
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bdd0b1e6589db3d1.
Report an issue: GitHub.