jackwener/OpenCLI · warning · CliError
NOT_FOUND
NOT_FOUND
Error message
No suggestions found
What it means
The google suggest command throws this CliError with code NOT_FOUND when the endpoint responds 200 but the JSON payload has no suggestions array (data[1] missing or empty). It means Google returned a well-formed but empty completion response for the keyword.
Source
Thrown at clis/google/suggest.js:31
browser: false,
args: [
{ name: 'keyword', positional: true, required: true, help: 'Search query' },
{ name: 'lang', default: 'zh-CN', help: 'Language code' },
],
columns: ['suggestion'],
func: async (args) => {
const keyword = encodeURIComponent(args.keyword);
const lang = encodeURIComponent(args.lang);
const url = `https://suggestqueries.google.com/complete/search?client=firefox&q=${keyword}&hl=${lang}`;
const resp = await fetch(url);
if (!resp.ok) {
throw new CliError('FETCH_ERROR', `HTTP ${resp.status}`, 'Check your network connection');
}
const data = await resp.json();
// Response format: ["query", ["suggestion1", "suggestion2", ...]]
const suggestions = Array.isArray(data) && Array.isArray(data[1]) ? data[1] : [];
if (!suggestions.length) {
throw new CliError('NOT_FOUND', 'No suggestions found', 'Try a different keyword');
}
return suggestions.map(s => ({ suggestion: s }));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Try a more common or longer keyword — rare terms often have zero completions
- Check the keyword isn't a term Google filters out of autocomplete (sensitive/filtered topics)
- Log the raw response body to confirm the schema still matches [query, suggestions]
- Treat empty suggestions as a normal empty result in calling code rather than a hard failure
Example fix
// before
if (!suggestions.length) throw new CliError('NOT_FOUND', 'No suggestions found', 'Try a different keyword');
// after
return suggestions.map(s => ({suggestion: s})); // caller handles empty array gracefully Defensive patterns
Strategy: fallback
Validate before calling
// validate keyword before calling
if (!keyword || !keyword.trim()) throw new Error('keyword required'); Type guard
function hasSuggestions(data) {
return Array.isArray(data) && Array.isArray(data[1]) && data[1].length > 0;
} Try / catch
try {
return await suggestCommand.func(args);
} catch (e) {
if (e.code === 'NOT_FOUND') return []; // empty completions are a normal outcome
throw e;
} Prevention
- Treat empty completions as valid empty results in batch keyword research
- Avoid sensitive/filtered keywords known to be suppressed by Google autocomplete
- Prefer longer, common phrases which reliably have completions
- Log raw responses to detect schema changes early
When it happens
Trigger: fetch succeeds, resp.json() parses, but Array.isArray(data[1]) is false or data[1].length === 0 — e.g. a keyword with no autocomplete entries, a keyword filtered by Google (violence/adult terms), or an unexpected response schema.
Common situations: Querying very short, nonsense, or newly-coined terms that have no recorded completions; keywords suppressed by Google's autocomplete policy (sensitive terms); Google changing the response shape from [query, [sugs]] to something else; non-JSON body (e.g. HTML error page) causing data to be a string so data[1] is a character, not an array — though then it would likely throw in json parsing first.
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/2fd87b54c095ae8d.
Report an issue: GitHub.