jackwener/OpenCLI · warning · EmptyResultError
No posts found for "${keyword}"
Error message
No posts found for "${keyword}" What it means
searchPosts pages through the Jike search API until it collects --limit rows. When the response contains no loadMoreKey (pagination exhausted) and zero rows were collected, it throws EmptyResultError signalling that the keyword genuinely matched nothing. This is an expected, non-exceptional outcome surfaced as a distinct error type so callers can distinguish it from failures.
Source
Thrown at clis/jike/search.js:56
async function searchPosts(page, keyword, limit) {
const rows = [];
const seenIds = new Set();
const seenCursors = new Set();
let loadMoreKey = null;
for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex++) {
const body = await fetchSearchPage(page, keyword, loadMoreKey);
for (const item of body.data) {
if (item?.type !== 'ORIGINAL_POST') continue;
const row = mapPost(item);
if (seenIds.has(row.id)) continue;
seenIds.add(row.id);
rows.push(row);
if (rows.length >= limit) return rows;
}
const next = body.loadMoreKey;
if (next == null) {
if (rows.length === 0) throw new EmptyResultError('jike search', `No posts found for "${keyword}"`);
return rows;
}
if (typeof next !== 'object' || Array.isArray(next)) {
throw new CommandExecutionError('Jike search API returned a malformed pagination cursor');
}
const cursorKey = JSON.stringify(next);
if (seenCursors.has(cursorKey)) {
throw new CommandExecutionError('Jike search pagination returned a repeated cursor');
}
seenCursors.add(cursorKey);
loadMoreKey = next;
}
throw new CommandExecutionError(`Jike search pagination exceeded ${MAX_PAGES} pages before satisfying --limit`);
}
cli({
site: 'jike',
name: 'search',View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the keyword with a different, broader query to confirm search works at all.
- Check you are logged into Jike in the browser session (requireJikeIdentity passed but content may still be restricted).
- Catch EmptyResultError explicitly and treat it as 'no results', not a crash.
Example fix
// before
const rows = await runCli(['jike', 'search', keyword]);
// after
try {
const rows = await runCli(['jike', 'search', keyword]);
} catch (e) {
if (e.name === 'EmptyResultError') return [];
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// check keyword plausibility before invoking
if (!keyword.trim()) throw new Error('provide a non-empty search keyword'); Try / catch
try {
return await runCli(['jike', 'search', keyword]);
} catch (e) {
if (e.name === 'EmptyResultError') return [];
throw e;
} Prevention
- Catch EmptyResultError separately and treat it as a normal empty result.
- Test the keyword interactively on web.okjike.com before automating.
- Keep the Jike session logged in so restricted results are not silently hidden.
When it happens
Trigger: The keyword search returns a successful body with an empty or no ORIGINAL_POST items across the first page, and body.loadMoreKey is null/undefined so no further pages can be fetched.
Common situations: Typo or overly specific query; searching rare/obsolete keywords; querying while logged out so results are filtered to zero; region/account restrictions hiding results.
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
- Jike search API returned a malformed post
- Jike search API returned a malformed pagination cursor
- Jike search pagination returned a repeated cursor
- No posts were returned for topic ${args.id}. Confirm the top
- openFDA returned no labels matching "${query}".
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/b252c48914683d76.
Report an issue: GitHub.