jackwener/OpenCLI · warning · EmptyResultError

No usable notes were rendered for this query.

Error message

No usable notes were rendered for this query.

What it means

An EmptyResultError thrown after a successful Xiaohongshu search harvest yielded zero rows with a title after filtering and limiting. The page rendered and was not collapsed, but no usable note entries were extracted, so the command cannot produce ranked results.

Source

Thrown at clis/xiaohongshu/search.js:905

            const keyword = encodeURIComponent(kwargs.query);
            const url = `https://www.xiaohongshu.com/search_result?keyword=${keyword}&source=web_search_result_notes`;
            await page.goto(url);
            let harvest = await collectSearchHarvest(page, limit, requestedFilters);
            if (isCollapsedRender(harvest.diag)) {
                await replaceCollapsedTab(page, url);
                harvest = await collectSearchHarvest(page, limit, requestedFilters);
                if (isCollapsedRender(harvest.diag)) {
                    throw new CommandExecutionError(
                        'Xiaohongshu search masonry remained collapsed after one fresh-tab recovery.',
                        'Retry later or use a different logged-in browser session.',
                    );
                }
            }
            const rows = harvest.rows
                .filter((item) => item.title)
                .slice(0, limit);
            if (rows.length === 0) {
                throw new EmptyResultError('xiaohongshu search', 'No usable notes were rendered for this query.');
            }
            return rows
                .map((item, i) => ({
                rank: i + 1,
                ...item,
                published_at: noteIdToDate(item.url),
            }));
        }
        catch (err) {
            if (err instanceof CliError)
                throw err;
            throw new CommandExecutionError(`Xiaohongshu search failed: ${err?.message ?? String(err)}`);
        }
    },
});
export const __test__ = {
    harvestOptionsForLimit,
    stripXhsAuthorDateSuffix,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a broader or more common search query and fewer filters to confirm results exist.
  2. Open the same search URL manually in the logged-in browser to confirm the site actually shows notes.
  3. Update the library if the site markup changed (selectors extract rows/titles).
  4. If this is expected emptiness, catch EmptyResultError in your caller and treat it as an empty dataset rather than a failure.
  5. Check requested filter values (sort/type filters) for typos that eliminate all results.

Example fix

// before
const rows = await xhsSearch(query, { limit });
// after
let rows;
try {
  rows = await xhsSearch(query, { limit });
} catch (e) {
  if (e instanceof EmptyResultError) rows = [];
  else throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// check query non-trivial and filters valid before calling
if (!query.trim()) throw new Error('search query required');

Try / catch

try {
  rows = await xhsSearch(query, { limit });
} catch (err) {
  if (err instanceof EmptyResultError) return [];
  throw err;
}

Prevention

When it happens

Trigger: harvest.rows filtered to items with a truthy title and sliced to `limit` results in rows.length === 0 inside the xiaohongshu search command handler.

Common situations: A query with genuinely no matching notes (very obscure keyword or heavy filters); Xiaohongshu layout change breaking the row/title selectors; region/language settings showing an empty results grid; request filters (requestedFilters) too restrictive.

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