jackwener/OpenCLI · warning · CliError
NOT_FOUND
NOT_FOUND
Error message
NOT_FOUND
What it means
CliError with code NOT_FOUND thrown when the in-page Weibo search scrape returns zero rows. The CLI evaluates a search-results extractor on weibo.com, unwraps it with the 'weibo search' tag, and treats an empty array as 'nothing found' rather than returning an empty list.
Source
Thrown at clis/weibo/search.js:73
url.match(/^https?:\\/\\/(?:www\\.)?weibo\\.com\\/(?:detail|status)\\/([A-Za-z0-9]+)(?:[?#/]|$)/);
const title = clean(contentEl && contentEl.textContent);
if (!title) continue;
rows.push({
id: idMatch ? idMatch[1] : '',
title,
author: clean(authorEl && authorEl.textContent),
time: clean(timeEl && timeEl.textContent),
url,
});
}
return rows;
})()
`)), 'weibo search');
if (data.length === 0) {
throw new CliError('NOT_FOUND', 'No Weibo search results found', 'Try a different keyword or ensure you are logged into weibo.com');
}
return data.slice(0, limit).map((item, index) => ({
rank: index + 1,
...item,
}));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Try a different, more common keyword to test whether search works at all
- Verify you are logged into weibo.com in the browser session
- Check weibo.com search manually for the keyword — if results exist there but not here, update the CLI for the new DOM structure
- Retry later if Weibo is rate-limiting or showing a captcha
Example fix
// before
const rows = await search(keyword);
// after
const rows = await search(keyword);
if (!rows.length) throw new CliError('NOT_FOUND', 'No Weibo search results found', 'Try a different keyword or ensure you are logged into weibo.com'); Defensive patterns
Strategy: try-catch
Validate before calling
if (!keyword || !keyword.trim()) {
throw new Error('Keyword is required for weibo search');
} Try / catch
try {
const results = await weiboSearch(keyword);
} catch (err) {
if (err.code === 'NOT_FOUND') {
console.warn(`No results for "${keyword}"; try a broader term or verify login.`);
results = [];
} else throw err;
} Prevention
- Check err.code === 'NOT_FOUND' specifically rather than message text
- Verify login state before searching
- Test with a common keyword first to distinguish 'no results' from 'broken extractor'
- Handle empty results gracefully in downstream code
When it happens
Trigger: Calling `weibo search <keyword>` where the scraped data array is empty — the search page rendered no result cards (or the extractor failed to match the current DOM and produced no rows).
Common situations: Obscure keyword with no Weibo results; not logged in so Weibo shows a login wall instead of results; Weibo changed search-results markup so the extractor matches nothing (looks like 'no results'); typo'd or over-filtered keyword.
Understand the failure class
Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.
Related errors
- NOT_FOUND
- No items match "${query}" on archive.org.
- No hotels rendered (${totalText}). Try a broader destination
- No Douyin videos matched "${keyword}".
- flathub search
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a1a8d9f638aa33f3.
Report an issue: GitHub.