{"record":{"id":"4fbd2dc381364df7","repo":"ZhuLinsen/daily_stock_analysis","slug":"fetch-failed-upstream-request-failed","errorCode":null,"errorMessage":"fetch failed: upstream request failed","messagePattern":"fetch failed: upstream request failed","errorType":"exception","errorClass":"IntelligenceServiceError","httpStatus":400,"severity":"error","filePath":"src/services/intelligence_service.py","lineNumber":495,"sourceCode":"                chunks = []\n                total = 0\n                for chunk in response.iter_content(chunk_size=8192):\n                    if not chunk:\n                        continue\n                    total += len(chunk)\n                    if total > _MAX_FEED_BYTES:\n                        raise IntelligenceServiceError(\"feed response is too large\")\n                    chunks.append(chunk)\n                content = b\"\".join(chunks)\n            else:\n                content = response.content[: _MAX_FEED_BYTES + 1]\n                if len(content) > _MAX_FEED_BYTES:\n                    raise IntelligenceServiceError(\"feed response is too large\")\n            return self._parse_feed(content, source_name=fields[\"name\"], limit=limit)\n        except IntelligenceServiceError:\n            raise\n        except Exception as exc:\n            raise IntelligenceServiceError(_UPSTREAM_FETCH_FAILURE_MESSAGE) from exc\n        finally:\n            if response is not None:\n                response.close()\n\n    def _fetch_newsnow_entries(self, fields: Dict[str, Any], *, limit: int) -> List[FeedEntry]:\n        timeout = max(1, min(float(self.config.news_intel_fetch_timeout_sec), 30.0))\n        headers = {\n            \"User-Agent\": (\n                \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 \"\n                \"(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 daily-stock-analysis-intel/1.0\"\n            ),\n            \"Accept\": \"application/json\",\n        }\n        self._validate_url(fields[\"url\"])\n        response = None\n        try:\n            response = self._get_with_validated_dns(\n                fields[\"url\"],","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/src/services/intelligence_service.py#L477-L513","documentation":"Error \"fetch failed: upstream request failed\" thrown in ZhuLinsen/daily_stock_analysis.","triggerScenarios":"Thrown at src/services/intelligence_service.py:495 when the library encounters an invalid state.","commonSituations":"Raised when the upstream feed request fails; occurs on network errors, timeouts, or non-success status codes from the source.","solutions":["Check network connectivity to the upstream feed host.","Retry the fetch; verify the upstream service is up.","Inspect logs for the underlying HTTP error and adjust timeout or URL accordingly."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5159bd72e8373d215492dff122acc9d389e219c9","analyzedAt":"2026-08-15T01:59:36.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}