ZhuLinsen/daily_stock_analysis · error · IntelligenceServiceError

feed redirect chain exceeds {_MAX_FEED_REDIRECTS}

Error message

feed redirect chain exceeds {_MAX_FEED_REDIRECTS}

What it means

Error "feed redirect chain exceeds {_MAX_FEED_REDIRECTS}" thrown in ZhuLinsen/daily_stock_analysis.

Source

Thrown at src/services/intelligence_service.py:472

                    request_url,
                    timeout=timeout,
                    headers=headers,
                    allow_redirects=False,
                    stream=True,
                )
                status_code = int(getattr(response, "status_code", 200))
                if status_code in _REDIRECT_STATUS_CODES:
                    location = getattr(response, "headers", {}).get("Location")
                    if not location:
                        raise IntelligenceServiceError("feed redirect missing Location header")
                    response.close()
                    request_url = urljoin(request_url, location)
                    self._validate_url(request_url)
                    continue
                response.raise_for_status()
                break
            else:
                raise IntelligenceServiceError(f"feed redirect chain exceeds {_MAX_FEED_REDIRECTS}")

            self._validate_url(response.url or request_url)

            if hasattr(response, "iter_content") and callable(response.iter_content):
                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")

View on GitHub (pinned to 5159bd72e8)

Solutions

  1. Update the source URL to the final destination to skip the redirect chain.
  2. Check for redirect loops at the feed provider.
  3. Replace the source if the provider keeps chaining redirects.

When it happens

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

Common situations: Raised when a feed redirect chain exceeds the maximum allowed hops; occurs with redirect loops or overly long chains from the feed provider.


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