jackwener/OpenCLI · info · EmptyResultError

未找到匹配 "${query}" 的候选人

Error message

未找到匹配 "${query}" 的候选人

What it means

EmptyResultError signalling a genuinely successful query whose talent list was an explicit empty array — no candidates matched the query. Unlike the missing-list case, this is an expected, non-failure outcome.

Source

Thrown at clis/maimai/search-talents.js:145

    if (!data || typeof data !== 'object' || Array.isArray(data)) {
      throw new CommandExecutionError('Maimai search returned malformed API payload');
    }

    // Extract talent list from response. Missing list fields mean the API
    // shape drifted; only an explicit empty array is a true empty result.
    const talentListCandidates = [
      data.data?.list,
      data.data?.talent_list,
      data.list,
      data.talent_list,
    ];
    const talentList = talentListCandidates.find((value) => Array.isArray(value));
    if (!talentList) {
      throw new CommandExecutionError('Maimai search API payload missing talent list');
    }

    if (talentList.length === 0) {
      throw new EmptyResultError('maimai search-talents', `未找到匹配 "${query}" 的候选人`);
    }

    // Map to output format
    return talentList.map(item => {
      // Extract school info (first one)
      const schoolInfo = item.edu && item.edu.length > 0 ? item.edu[0] : {};

      // Work years: use work_time field directly (e.g., "11 年", "10 年")
      const workYear = item.work_time || item.worktime || '';

      // Extract all companies from work experience (deduplicated, excluding current company)
      const currentCompany = item.company || '';
      const historicalCompanies = (item.exp || [])
        .map(e => e.company)
        .filter(c => c && c.trim() !== '' && c !== currentCompany)
        .filter((c, i, arr) => arr.indexOf(c) === i)
        .join(' / ');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Broaden the query keywords (shorter, more generic terms).
  2. Remove or relax filters passed to search-talents.
  3. Try alternate spellings or Chinese-language search terms.
  4. Confirm the target person exists by searching maimai.cn in the browser.

Example fix

// before
maimai search-talents "Senior VP of Platform Engineering at Acme Corp Hangzhou"
// after
maimai search-talents "Acme Corp"  # broaden, then refine client-side
Defensive patterns

Strategy: fallback

Try / catch

try {
  const talents = await searchTalents(query);
} catch (e) {
  if (e instanceof EmptyResultError || /未找到匹配/.test(e.message)) {
    console.warn(`No candidates for "${query}"; try broader keywords`);
    talents = [];
  } else throw e;
}

Prevention

When it happens

Trigger: maimai search API returned code 200/0 with an empty list for the given query keywords/filters.

Common situations: Overly specific search terms, rare job titles or employers, filters (industry/location) too narrow, non-Chinese query terms with no matches.

Related errors


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