{"record":{"id":"38f36a79382e8b91","repo":"ZhuLinsen/daily_stock_analysis","slug":"source-url-host-dns-resolution-failed-hostname","errorCode":null,"errorMessage":"source url host DNS resolution failed: {hostname}","messagePattern":"source url host DNS resolution failed: (.+?)","errorType":"validation","errorClass":"IntelligenceServiceError","httpStatus":400,"severity":"error","filePath":"src/services/intelligence_service.py","lineNumber":417,"sourceCode":"            raise IntelligenceServiceError(\"source url must not contain credentials\")\n        hostname = (parsed.hostname or \"\").strip().lower().rstrip(\".\")\n        if not hostname:\n            raise IntelligenceServiceError(\"source url host is required\")\n        if hostname in _PRIVATE_HOSTNAMES or hostname.endswith(\".local\"):\n            raise IntelligenceServiceError(\"source url host is not allowed\")\n        has_public_address = False\n        try:\n            ip = ipaddress.ip_address(hostname)\n        except ValueError:\n            ip = None\n        if ip is not None:\n            if self._is_blocked_ip(ip):\n                raise IntelligenceServiceError(\"source url must not target private or local network addresses\")\n            return\n        try:\n            addr_infos = socket.getaddrinfo(hostname, None)\n        except OSError as exc:\n            raise IntelligenceServiceError(f\"source url host DNS resolution failed: {hostname}\") from exc\n        if not addr_infos:\n            raise IntelligenceServiceError(f\"source url host DNS resolution failed: {hostname}\")\n        for info in addr_infos:\n            try:\n                ip = ipaddress.ip_address(info[4][0])\n            except (IndexError, ValueError):\n                continue\n            if self._is_blocked_ip(ip):\n                raise IntelligenceServiceError(\"source url must not target private or local network addresses\")\n            has_public_address = True\n        if not has_public_address:\n            raise IntelligenceServiceError(f\"source url host DNS resolution failed: {hostname}\")\n\n    @staticmethod\n    def _is_blocked_ip(ip: ipaddress._BaseAddress) -> bool:\n        return (\n            not ip.is_global\n            or ip.is_private","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/src/services/intelligence_service.py#L399-L435","documentation":"Error \"source url host DNS resolution failed: {hostname}\" thrown in ZhuLinsen/daily_stock_analysis.","triggerScenarios":"Thrown at src/services/intelligence_service.py:417 when the library encounters an invalid state.","commonSituations":"Raised when DNS resolution of the intelligence source host fails; occurs with non-existent domains or DNS outages during source validation.","solutions":["Check the hostname for typos and that DNS resolution works from the host.","Verify network/DNS configuration on the machine running the service.","Retry later if the upstream DNS is temporarily failing; otherwise replace the source."],"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-15T22:17:37.221Z"}