{"record":{"id":"7def16d4c2ba7024","repo":"ZhuLinsen/daily_stock_analysis","slug":"feed-redirect-missing-location-header","errorCode":null,"errorMessage":"feed redirect missing Location header","messagePattern":"feed redirect missing Location header","errorType":"exception","errorClass":"IntelligenceServiceError","httpStatus":400,"severity":"error","filePath":"src/services/intelligence_service.py","lineNumber":464,"sourceCode":"        timeout = max(1, min(float(self.config.news_intel_fetch_timeout_sec), 30.0))\n        headers = {\"User-Agent\": \"daily-stock-analysis-intel/1.0\"}\n        self._validate_url(fields[\"url\"])\n        request_url = fields[\"url\"]\n        response = None\n        try:\n            for _ in range(_MAX_FEED_REDIRECTS + 1):\n                response = self._get_with_validated_dns(\n                    request_url,\n                    timeout=timeout,\n                    headers=headers,\n                    allow_redirects=False,\n                    stream=True,\n                )\n                status_code = int(getattr(response, \"status_code\", 200))\n                if status_code in _REDIRECT_STATUS_CODES:\n                    location = getattr(response, \"headers\", {}).get(\"Location\")\n                    if not location:\n                        raise IntelligenceServiceError(\"feed redirect missing Location header\")\n                    response.close()\n                    request_url = urljoin(request_url, location)\n                    self._validate_url(request_url)\n                    continue\n                response.raise_for_status()\n                break\n            else:\n                raise IntelligenceServiceError(f\"feed redirect chain exceeds {_MAX_FEED_REDIRECTS}\")\n\n            self._validate_url(response.url or request_url)\n\n            if hasattr(response, \"iter_content\") and callable(response.iter_content):\n                chunks = []\n                total = 0\n                for chunk in response.iter_content(chunk_size=8192):\n                    if not chunk:\n                        continue\n                    total += len(chunk)","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/src/services/intelligence_service.py#L446-L482","documentation":"Error \"feed redirect missing Location header\" thrown in ZhuLinsen/daily_stock_analysis.","triggerScenarios":"Thrown at src/services/intelligence_service.py:464 when the library encounters an invalid state.","commonSituations":"Raised when a feed redirect response lacks a Location header; occurs with misbehaving upstream servers returning 3xx without a target.","solutions":["The feed redirect response lacked a Location header; verify the feed URL directly.","Update the source to the final feed URL to avoid the broken redirect.","Contact the feed provider or replace the source if the redirect is permanently broken."],"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"}