{"record":{"id":"9f2a53c0ceb40902","repo":"jackwener/OpenCLI","slug":"not-found-9f2a53","errorCode":"NOT_FOUND","errorMessage":"No news articles found","messagePattern":"No news articles found","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"warning","filePath":"clis/google/news.js","lineNumber":38,"sourceCode":"    ],\n    columns: ['title', 'source', 'date', 'url'],\n    func: async (args) => {\n        const limit = Math.max(1, Math.min(Number(args.limit), 100));\n        const lang = encodeURIComponent(args.lang);\n        const region = encodeURIComponent(args.region);\n        const ceid = `${args.region}:${args.lang}`;\n        // Top stories or search\n        const base = args.keyword\n            ? `https://news.google.com/rss/search?q=${encodeURIComponent(args.keyword)}&hl=${lang}&gl=${region}&ceid=${ceid}`\n            : `https://news.google.com/rss?hl=${lang}&gl=${region}&ceid=${ceid}`;\n        const resp = await fetch(base);\n        if (!resp.ok) {\n            throw new CliError('FETCH_ERROR', `HTTP ${resp.status}`, 'Check your network connection');\n        }\n        const xml = await resp.text();\n        const items = parseRssItems(xml, ['title', 'link', 'pubDate', 'source']);\n        if (!items.length) {\n            throw new CliError('NOT_FOUND', 'No news articles found', 'Try a different keyword or region');\n        }\n        return items.slice(0, limit).map(item => {\n            // Extract source: prefer <source> element, fallback to parsing title\n            let title = item['title'] || '';\n            let source = item['source'] || '';\n            if (!source) {\n                const idx = title.lastIndexOf(' - ');\n                if (idx !== -1) {\n                    source = title.slice(idx + 3);\n                    title = title.slice(0, idx);\n                }\n            }\n            return {\n                title,\n                source,\n                date: item['pubDate'] || '',\n                url: item['link'] || '',\n            };","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/google/news.js#L20-L56","documentation":"The google news command throws this CliError with code NOT_FOUND when the RSS feed fetched successfully but parseRssItems produced zero items. It distinguishes an empty/valid feed from a network failure, prompting the user to change keyword or region.","triggerScenarios":"A successful 200 response from news.google.com/rss whose XML contains no parseable <item> elements — e.g. a keyword with no matching articles for the chosen language/region, or a feed format change that breaks parseRssItems field extraction.","commonSituations":"Searching an obscure keyword combined with a restrictive gl/ceid locale that has no coverage; region code mismatch causing an empty localized feed; Google changing RSS item structure so the parser extracts nothing; very new topics with no indexed articles yet.","solutions":["Try a broader or different keyword","Remove or change the region/lang parameters to a default (e.g. en-US) that has wider coverage","Fetch the URL manually in a browser to confirm whether the feed itself is empty","If items exist in the browser but not here, update parseRssItems to handle the current RSS format"],"exampleFix":"// before\nif (!items.length) throw new CliError('NOT_FOUND', 'No news articles found', 'Try a different keyword or region');\n// after\nif (!items.length) {\n  console.warn('No articles; retrying with default locale');\n  items = parseRssItems(await (await fetch(baseDefaultLocale)).text(), ['title','link','pubDate','source']);\n}","handlingStrategy":"fallback","validationCode":"// pre-check keyword non-empty before invoking\nif (!keyword || !keyword.trim()) throw new Error('keyword required');","typeGuard":"function isNonEmptyItems(items) {\n  return Array.isArray(items) && items.length > 0;\n}","tryCatchPattern":"try {\n  return await newsCommand.func(args);\n} catch (e) {\n  if (e.code === 'NOT_FOUND') {\n    return newsCommand.func({...args, keyword: undefined}); // fallback to top stories\n  }\n  throw e;\n}","preventionTips":["Use broad keywords with wide news coverage","Fall back to default locale when a localized feed is empty","Treat NOT_FOUND as an empty result, not a crash","Spot-check the RSS URL in a browser when a query repeatedly returns nothing"],"tags":["rss","empty-result","google","not-found"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}