jackwener/OpenCLI · warning · EmptyResultError

boss search

Error message

boss search

What it means

This EmptyResultError belongs to the boss search command ('boss search' is the message/subject); it is thrown in the same data-collection flow as the EmptyResultError above when the aggregated job list ends up empty after pagination.

Source

Thrown at clis/boss/search.js:220

                    boss: j.bossName + ' · ' + j.bossTitle,
                    bossOnline: formatBossOnline(j.bossOnline),
                    security_id: j.encryptJobId || '',
                    url: 'https://www.zhipin.com/job_detail/' + j.encryptJobId + '.html',
                });
                addedInBatch++;
                if (allJobs.length >= limit)
                    break;
            }
            if (addedInBatch === 0) {
                verbose(`API returned duplicate page, stopping pagination at ${allJobs.length} items`);
                break;
            }
            if (!zpData.hasMore)
                break;
            currentPage++;
        }
        if (allJobs.length === 0) {
            throw new EmptyResultError('boss search', query ? `No BOSS jobs found for "${query}"` : 'BOSS returned no recommended jobs');
        }
        return allJobs;
    },
});
export const __test__ = {
    EXP_MAP,
    resolveCity,
    resolveMap,
    resolveJobType,
    formatBossOnline,
};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Broaden the query keyword or remove filters
  2. Search a larger city or 全国
  3. Retry later; verify the same search manually on the BOSS website
  4. Catch EmptyResultError and handle gracefully as zero results

Example fix

// before
const jobs = await cli('boss', 'search', {}); // empty recommended feed -> throws
// after
let jobs;
try { jobs = await cli('boss', 'search', {}); }
catch (e) {
  if (e.name !== 'EmptyResultError') throw e;
  jobs = []; // treat as no recommendations right now
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  jobs = await cli('boss', 'search', opts);
} catch (e) {
  if (e.name === 'EmptyResultError') jobs = [];
  else throw e;
}

Prevention

When it happens

Trigger: Identical to error 566/567's sibling case: every captured page returned a payload without usable jobList entries or hasMore ended with allJobs.length === 0 for the given query/filters.

Common situations: Same as the boss-search empty result family: hyper-specific filters, empty recommendation feed, throttled/degraded BOSS responses returning empty lists.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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