{"record":{"id":"acdc55eedaa9f06f","repo":"jackwener/OpenCLI","slug":"no-usable-notes-were-rendered-for-this-query","errorCode":null,"errorMessage":"No usable notes were rendered for this query.","messagePattern":"No usable notes were rendered for this query\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xiaohongshu/search.js","lineNumber":905,"sourceCode":"            const keyword = encodeURIComponent(kwargs.query);\n            const url = `https://www.xiaohongshu.com/search_result?keyword=${keyword}&source=web_search_result_notes`;\n            await page.goto(url);\n            let harvest = await collectSearchHarvest(page, limit, requestedFilters);\n            if (isCollapsedRender(harvest.diag)) {\n                await replaceCollapsedTab(page, url);\n                harvest = await collectSearchHarvest(page, limit, requestedFilters);\n                if (isCollapsedRender(harvest.diag)) {\n                    throw new CommandExecutionError(\n                        'Xiaohongshu search masonry remained collapsed after one fresh-tab recovery.',\n                        'Retry later or use a different logged-in browser session.',\n                    );\n                }\n            }\n            const rows = harvest.rows\n                .filter((item) => item.title)\n                .slice(0, limit);\n            if (rows.length === 0) {\n                throw new EmptyResultError('xiaohongshu search', 'No usable notes were rendered for this query.');\n            }\n            return rows\n                .map((item, i) => ({\n                rank: i + 1,\n                ...item,\n                published_at: noteIdToDate(item.url),\n            }));\n        }\n        catch (err) {\n            if (err instanceof CliError)\n                throw err;\n            throw new CommandExecutionError(`Xiaohongshu search failed: ${err?.message ?? String(err)}`);\n        }\n    },\n});\nexport const __test__ = {\n    harvestOptionsForLimit,\n    stripXhsAuthorDateSuffix,","sourceCodeStart":887,"sourceCodeEnd":923,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/search.js#L887-L923","documentation":"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.","triggerScenarios":"harvest.rows filtered to items with a truthy title and sliced to `limit` results in rows.length === 0 inside the xiaohongshu search command handler.","commonSituations":"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.","solutions":["Retry with a broader or more common search query and fewer filters to confirm results exist.","Open the same search URL manually in the logged-in browser to confirm the site actually shows notes.","Update the library if the site markup changed (selectors extract rows/titles).","If this is expected emptiness, catch EmptyResultError in your caller and treat it as an empty dataset rather than a failure.","Check requested filter values (sort/type filters) for typos that eliminate all results."],"exampleFix":"// before\nconst rows = await xhsSearch(query, { limit });\n// after\nlet rows;\ntry {\n  rows = await xhsSearch(query, { limit });\n} catch (e) {\n  if (e instanceof EmptyResultError) rows = [];\n  else throw e;\n}","handlingStrategy":"try-catch","validationCode":"// check query non-trivial and filters valid before calling\nif (!query.trim()) throw new Error('search query required');","typeGuard":null,"tryCatchPattern":"try {\n  rows = await xhsSearch(query, { limit });\n} catch (err) {\n  if (err instanceof EmptyResultError) return [];\n  throw err;\n}","preventionTips":["Use specific enough queries that notes exist","Catch EmptyResultError and treat it as empty data when appropriate","Keep the library updated for selector changes","Double-check filter arguments"],"tags":["xhs","empty-results","scraping"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}