jackwener/OpenCLI · warning · EmptyResultError

uid 在招聘端与求职端聊天列表中均未找到

Error message

uid 在招聘端与求职端聊天列表中均未找到

What it means

In the chatmsg command's auto mode, this EmptyResultError('uid 在招聘端与求职端聊天列表中均未找到') is thrown only after both lookups fail: findFriendByUid on the recruiter side returned nothing (or only an identity-mismatch code), and the fallback findGeekByUid on the job-seeker side also found no match. It definitively means the uid is not in any chat list visible to the current session on either side.

Source

Thrown at clis/boss/chatmsg.js:112

            const encryptSystemId = await readEncryptSystemId(page);
            return await geekChatMsg(page, normalizedKwargs, encryptSystemId);
        }

        // auto: try recruiter first, fall back to geek when not found or identity mismatch
        await navigateToChat(page);
        const bossResult = await findFriendByUid(page, uid, { allowNonZero: true });
        if (bossResult?.friend) {
            return await bossChatMsg(page, normalizedKwargs, bossResult.friend);
        }
        // Not found or identity mismatch — check for hard errors before falling back
        if (bossResult?.code && bossResult.code !== 0 && bossResult.code !== IDENTITY_MISMATCH_CODE) {
            assertOk(bossResult);
        }
        // Fall back to geek side
        await navigateToGeekChat(page);
        const encryptSystemId = await readEncryptSystemId(page);
        const geekFriend = await findGeekFriendByUid(page, uid, { encryptSystemId });
        if (!geekFriend) throw new EmptyResultError('boss chatmsg', 'uid 在招聘端与求职端聊天列表中均未找到');
        if (!geekFriend.securityId) throw new CommandExecutionError('该聊天缺少 securityId,无法获取历史消息');
        const messages = await fetchGeekHistoryMsg(page, geekFriend, { page: pageNum });
        return messages.map((m) => mapGeekMsg(m, geekFriend));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run `opencli boss chatlist` (and the geek-side equivalent) and copy the uid fresh from the output.
  2. Quote the uid in your shell: encrypted values can contain characters shells interpret (e.g. `opencli boss chatmsg '0xAbC+123'`).
  3. Verify both boss and geek sessions are logged in (run a simple command like `opencli boss whoami` / refresh cookies).
  4. Confirm the conversation still exists in the BOSS web UI on at least one side.
  5. If the uid came from another tool/older export, it may be stale — regenerate it from the current chatlist.

Example fix

// before
opencli boss chatmsg 0x9k+2/dQ==   # shell eats + and /
// after
opencli boss chatmsg '0x9k+2/dQ==' # quoted, complete encrypted uid
Defensive patterns

Strategy: validation

Validate before calling

// resolve the uid from the live chatlist before calling chatmsg
const all = [...await chatlist({}), ...await chatlist({ side: 'geek' })];
const match = all.find(f => f.uid === uid);
if (!match) throw new Error(`uid ${uid} absent from both sides — refresh chatlist`);

Type guard

function isKnownUid(uid, lists) { return lists.flat().some(f => f.uid === uid); }

Try / catch

try {
  const msgs = await chatmsg(uid);
} catch (e) {
  if (isEmptyResultError(e) && /均未找到/.test(e.message)) {
    // refresh uid from a new chatlist run, or report unknown uid
    throw new Error(`stale/unknown uid: ${uid}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: `boss chatmsg <uid>` (auto) with a uid that matches no conversation in either the recruiter's or the job-seeker's chat list — invalid/stale/foreign uid, empty chat list due to missing login, or both accounts lack the conversation.

Common situations: uid from an old chatlist run after the conversation was deleted; uid belongs to a different BOSS account entirely; both sessions logged out so chat lists render empty; typos or shell-mangled encrypted uid (special characters like + or = not quoted).

Related errors


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