{"record":{"id":"2fd87b54c095ae8d","repo":"jackwener/OpenCLI","slug":"not-found-2fd87b","errorCode":"NOT_FOUND","errorMessage":"No suggestions found","messagePattern":"No suggestions found","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"warning","filePath":"clis/google/suggest.js","lineNumber":31,"sourceCode":"    browser: false,\n    args: [\n        { name: 'keyword', positional: true, required: true, help: 'Search query' },\n        { name: 'lang', default: 'zh-CN', help: 'Language code' },\n    ],\n    columns: ['suggestion'],\n    func: async (args) => {\n        const keyword = encodeURIComponent(args.keyword);\n        const lang = encodeURIComponent(args.lang);\n        const url = `https://suggestqueries.google.com/complete/search?client=firefox&q=${keyword}&hl=${lang}`;\n        const resp = await fetch(url);\n        if (!resp.ok) {\n            throw new CliError('FETCH_ERROR', `HTTP ${resp.status}`, 'Check your network connection');\n        }\n        const data = await resp.json();\n        // Response format: [\"query\", [\"suggestion1\", \"suggestion2\", ...]]\n        const suggestions = Array.isArray(data) && Array.isArray(data[1]) ? data[1] : [];\n        if (!suggestions.length) {\n            throw new CliError('NOT_FOUND', 'No suggestions found', 'Try a different keyword');\n        }\n        return suggestions.map(s => ({ suggestion: s }));\n    },\n});\n","sourceCodeStart":13,"sourceCodeEnd":36,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/google/suggest.js#L13-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nif (!suggestions.length) throw new CliError('NOT_FOUND', 'No suggestions found', 'Try a different keyword');\n// after\nreturn suggestions.map(s => ({suggestion: s})); // caller handles empty array gracefully","handlingStrategy":"fallback","validationCode":"// validate keyword before calling\nif (!keyword || !keyword.trim()) throw new Error('keyword required');","typeGuard":"function hasSuggestions(data) {\n  return Array.isArray(data) && Array.isArray(data[1]) && data[1].length > 0;\n}","tryCatchPattern":"try {\n  return await suggestCommand.func(args);\n} catch (e) {\n  if (e.code === 'NOT_FOUND') return []; // empty completions are a normal outcome\n  throw e;\n}","preventionTips":["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"],"tags":["empty-result","google","autocomplete","not-found"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}