jackwener/OpenCLI · error

未找到该候选人

Error message

未找到该候选人

What it means

`opencli boss invite` sends an interview invitation and, like exchange, requires the candidate to be found via findFriendByUid (chat list + greet list). If not found it throws '未找到该候选人'. You cannot invite a candidate who is not in your current chat/greet lists.

Source

Thrown at clis/boss/invite.js:28

    description: 'BOSS直聘发送面试邀请',
    domain: 'www.zhipin.com',
    strategy: Strategy.COOKIE,
    navigateBefore: false,
    browser: true,
    args: [
        { name: 'uid', positional: true, required: true, help: 'Encrypted UID of the candidate' },
        { name: 'time', required: true, help: 'Interview time (e.g. 2025-04-01 14:00)' },
        { name: 'address', default: '', help: 'Interview address (uses saved address if empty)' },
        { name: 'contact', default: '', help: 'Contact person name (uses saved contact if empty)' },
    ],
    columns: ['status', 'detail'],
    func: async (page, kwargs) => {
        requirePage(page);
        verbose(`Sending interview invitation to ${kwargs.uid}...`);
        await navigateToChat(page);
        const friend = await findFriendByUid(page, kwargs.uid, { checkGreetList: true });
        if (!friend)
            throw new Error('未找到该候选人');
        const friendName = friend.name || '候选人';
        // Get saved contact info
        const contactData = await bossFetch(page, 'https://www.zhipin.com/wapi/zpinterview/boss/interview/contactInit', { allowNonZero: true, timeout: 10_000 });
        const contactName = kwargs.contact || contactData.zpData?.contactName || '';
        const contactPhone = contactData.zpData?.contactPhone || '';
        const contactId = contactData.zpData?.contactId || '';
        // Get saved address
        const addressData = await bossFetch(page, 'https://www.zhipin.com/wapi/zpinterview/boss/interview/listAddress', { allowNonZero: true, timeout: 10_000 });
        const savedAddress = addressData.zpData?.list?.[0] || {};
        const addressText = kwargs.address || savedAddress.cityAddressText || savedAddress.addressText || '';
        // Parse interview time
        const interviewTime = new Date(kwargs.time).getTime();
        if (isNaN(interviewTime)) {
            throw new Error(`时间格式错误: ${kwargs.time},请使用格式如 2025-04-01 14:00`);
        }
        const params = new URLSearchParams({
            uid: String(friend.uid),
            securityId: friend.securityId || '',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Fetch a fresh uid via `opencli boss recommend` and retry.
  2. Confirm the candidate is in the BOSS chat/greet list in the browser.
  3. Re-check the uid for typos or truncation.
  4. Re-greet the candidate if the conversation was deleted, then retry the invite.

Example fix

// before
opencli boss invite <expired-uid> --time "2025-04-01 14:00"
// after
opencli boss recommend
opencli boss invite <fresh-uid> --time "2025-04-01 14:00"
Defensive patterns

Strategy: try-catch

Validate before calling

const uid = args.uid;
if (!uid || typeof uid !== 'string' || uid.trim() === '') {
  throw new Error('uid is required; obtain it from `opencli boss recommend`.');
}

Type guard

function isValidUid(v) {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  await run(['opencli', 'boss', 'invite', uid, '--time', t, '--address', addr]);
} catch (e) {
  if (e.message.includes('未找到该候选人')) {
    console.error('Refresh uid via `opencli boss recommend`; candidate must be in chat/greet list.');
  }
  throw e;
}

Prevention

When it happens

Trigger: `opencli boss invite <uid> --time ...` with a uid that no longer (or never did) resolves to a friend row: stale/expired uid, deleted chat, candidate not greeted, or list pagination not reaching them.

Common situations: Inviting a candidate collected from an old session; uid typo; candidate archived or chat deleted since collection; invite attempted before any greeting exchange occurred.

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/bf4af730c354b92a. Report an issue: GitHub.