{"record":{"id":"120d4fdaffa585ba","repo":"sansan0/TrendRadar","slug":"data-not-found-120d4f","errorCode":"DATA_NOT_FOUND","errorMessage":"未找到相关新闻（{time_desc}）","messagePattern":"未找到相关新闻（(.+?)）","errorType":"error_code","errorClass":"DataNotFoundError","httpStatus":null,"severity":"warning","filePath":"mcp_server/tools/analytics.py","lineNumber":763,"sourceCode":"                            }\n\n                            # 条件性添加 URL 字段\n                            if include_url:\n                                news_item[\"url\"] = info.get(\"url\", \"\")\n                                news_item[\"mobileUrl\"] = info.get(\"mobileUrl\", \"\")\n\n                            all_news_items.append(news_item)\n\n                except DataNotFoundError:\n                    # 该日期没有数据，继续下一天\n                    pass\n\n                # 下一天\n                current_date += timedelta(days=1)\n\n            if not all_news_items:\n                time_desc = \"今天\" if start_date == end_date else f\"{start_date.strftime('%Y-%m-%d')} 至 {end_date.strftime('%Y-%m-%d')}\"\n                raise DataNotFoundError(\n                    f\"未找到相关新闻（{time_desc}）\",\n                    suggestion=\"请尝试其他话题、日期范围或平台\"\n                )\n\n            # 去重（同一标题只保留一次）\n            unique_news = {}\n            for item in all_news_items:\n                key = f\"{item['platform']}::{item['title']}\"\n                if key not in unique_news:\n                    unique_news[key] = item\n                else:\n                    # 合并 ranks（如果同一新闻在多天出现）\n                    existing = unique_news[key]\n                    existing[\"ranks\"].extend(item[\"ranks\"])\n                    existing[\"count\"] = len(existing[\"ranks\"])\n\n            deduplicated_news = list(unique_news.values())\n","sourceCodeStart":745,"sourceCodeEnd":781,"githubUrl":"https://github.com/sansan0/TrendRadar/blob/8ee26026ba6c11dec41a95fb3895a7162876caa1/mcp_server/tools/analytics.py#L745-L781","documentation":"DataNotFoundError from the news-collection loop in analytics.py: after walking each date from start to end (skipping days whose per-day read raises DataNotFoundError), all_news_items is still empty. time_desc renders '今天' when start==end, else the explicit date span. Code DATA_NOT_FOUND.","triggerScenarios":"Searching a topic that appears in no titles during the range; range entirely composed of days with no crawled data; platform filter excluding every platform that mentioned the topic; overly specific topic phrasing that must match title text.","commonSituations":"Hot-topic analysis for a niche keyword; historical ranges predating the first crawl; combining a narrow date_range with a platforms filter that removes the only relevant source; crawler outage over the whole window.","solutions":["Widen the date range or drop the platforms filter.","Use a broader/shorter topic term that is more likely to be a title substring.","Confirm crawled data exists for at least some days in the range (see the parser-level DATA_NOT_FOUND for how per-day reads work).","If expecting today's data, verify the crawler ran today."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    news = tools._collect_news(topic, start, end, platforms)\nexcept DataNotFoundError:\n    news = []  # render an explicit 'no coverage' state instead of propagating","preventionTips":["Loosen platform filters and widen date ranges when coverage is thin.","Use broad topic terms likely to appear verbatim in headlines.","Treat this as an empty-result condition in the UI, not an error."],"tags":["data-not-found","topic","date-range","analytics"],"backgroundTag":null,"analyzedSha":"8ee26026ba6c11dec41a95fb3895a7162876caa1","analyzedAt":"2026-08-15T01:42:18.084Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}