ZhuLinsen/daily_stock_analysis · error · IntelligenceServiceError

fetch failed: upstream request failed

Error message

fetch failed: upstream request failed

What it means

Error "fetch failed: upstream request failed" thrown in ZhuLinsen/daily_stock_analysis.

Source

Thrown at src/services/intelligence_service.py:495

                chunks = []
                total = 0
                for chunk in response.iter_content(chunk_size=8192):
                    if not chunk:
                        continue
                    total += len(chunk)
                    if total > _MAX_FEED_BYTES:
                        raise IntelligenceServiceError("feed response is too large")
                    chunks.append(chunk)
                content = b"".join(chunks)
            else:
                content = response.content[: _MAX_FEED_BYTES + 1]
                if len(content) > _MAX_FEED_BYTES:
                    raise IntelligenceServiceError("feed response is too large")
            return self._parse_feed(content, source_name=fields["name"], limit=limit)
        except IntelligenceServiceError:
            raise
        except Exception as exc:
            raise IntelligenceServiceError(_UPSTREAM_FETCH_FAILURE_MESSAGE) from exc
        finally:
            if response is not None:
                response.close()

    def _fetch_newsnow_entries(self, fields: Dict[str, Any], *, limit: int) -> List[FeedEntry]:
        timeout = max(1, min(float(self.config.news_intel_fetch_timeout_sec), 30.0))
        headers = {
            "User-Agent": (
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
                "(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 daily-stock-analysis-intel/1.0"
            ),
            "Accept": "application/json",
        }
        self._validate_url(fields["url"])
        response = None
        try:
            response = self._get_with_validated_dns(
                fields["url"],

View on GitHub (pinned to 5159bd72e8)

Solutions

  1. Check network connectivity to the upstream feed host.
  2. Retry the fetch; verify the upstream service is up.
  3. Inspect logs for the underlying HTTP error and adjust timeout or URL accordingly.

When it happens

Trigger: Thrown at src/services/intelligence_service.py:495 when the library encounters an invalid state.

Common situations: Raised when the upstream feed request fails; occurs on network errors, timeouts, or non-success status codes from the source.


AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15). Data as JSON: /api/errors/4fbd2dc381364df7. Report an issue: GitHub.