jackwener/OpenCLI · error

未找到该候选人,请确认 uid 是否正确(可从 recommend 命令获取)

Error message

未找到该候选人,请确认 uid 是否正确(可从 recommend 命令获取)

What it means

`opencli boss greet` looks up the candidate once (single page, checkGreetList: true) and throws this Chinese error if findFriendByUid returns nothing. Unlike exchange, greet limits the scan to one page, so the candidate must be near the top of the chat/greet list. The message points users to the `recommend` command as the source of valid uids.

Source

Thrown at clis/boss/greet.js:32

    browser: true,
    args: [
        { name: 'uid', positional: true, required: true, help: 'Encrypted UID of the candidate (from recommend)' },
        { name: 'security-id', required: true, help: 'Security ID of the candidate' },
        { name: 'job-id', required: true, help: 'Encrypted job ID' },
        { name: 'text', default: '', help: 'Custom greeting message (uses default template if empty)' },
    ],
    columns: ['status', 'detail'],
    func: async (page, kwargs) => {
        requirePage(page);
        verbose(`Greeting candidate ${kwargs.uid}...`);
        await navigateToChat(page, 3);
        // Find candidate in greet list or friend list
        const friend = await findFriendByUid(page, kwargs.uid, {
            maxPages: 1,
            checkGreetList: true,
        });
        if (!friend) {
            throw new Error('未找到该候选人,请确认 uid 是否正确(可从 recommend 命令获取)');
        }
        const numericUid = friend.uid;
        const friendName = friend.name || '候选人';
        const clicked = await clickCandidateInList(page, numericUid);
        if (!clicked) {
            throw new Error('无法在聊天列表中找到该用户,候选人可能不在当前列表中');
        }
        await page.wait({ time: 2 });
        const msgText = kwargs.text || '你好,请问您对这个职位感兴趣吗?';
        const sent = await typeAndSendMessage(page, msgText);
        if (!sent) {
            throw new Error('找不到消息输入框');
        }
        await page.wait({ time: 1 });
        return [{ status: '✅ 招呼已发送', detail: `已向 ${friendName} 发送: ${msgText}` }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Get a fresh uid via `opencli boss recommend` and retry immediately.
  2. Verify the candidate is visible in the first page of the BOSS chat list in the browser.
  3. Re-check the uid string for typos or truncation.
  4. If the candidate is deeper in the list, use `resume` (maxPages: 5) first or re-greet from the recommend flow to bring them to the top.

Example fix

// before
opencli boss greet <old-uid-from-last-week>
// after
opencli boss recommend          # fresh uid from greet list
opencli boss greet <fresh-uid> --text "你好..."
Defensive patterns

Strategy: try-catch

Validate before calling

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

Type guard

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

Try / catch

try {
  await run(['opencli', 'boss', 'greet', uid]);
} catch (e) {
  if (e.message.includes('未找到该候选人')) {
    console.error('Greet scans only one list page — refresh uid via `opencli boss recommend` and retry.');
  }
  throw e;
}

Prevention

When it happens

Trigger: `opencli boss greet <uid>` with a uid absent from the first page of the chat list and the greet list — stale uid, typo, or candidate buried below page one of the list.

Common situations: Greeting a candidate whose chat is older than the first list page; uid from a previous session after BOSS re-encrypted ids; misspelled uid; calling greet on someone never contacted (no greet-list entry).

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/bacd2fa724afed90. Report an issue: GitHub.