{"record":{"id":"3fad350bb10302b1","repo":"Fosowl/agenticSeek","slug":"network-error-occurred-check-your-internet-connec","errorCode":null,"errorMessage":"Network error occurred. Check your internet connection.","messagePattern":"Network error occurred\\. Check your internet connection\\.","errorType":"exception","errorClass":"NetworkError","httpStatus":null,"severity":"error","filePath":"sources/llm_provider.py","lineNumber":504,"sourceCode":"        )\n        thought = \"\"\n        message = '\\n---\\n'.join([f\"{msg['role']}: {msg['content']}\" for msg in history])\n\n        try:\n            api = DeepSeekAPI(self.api_key)\n            chat_id = api.create_chat_session()\n            for chunk in api.chat_completion(chat_id, message):\n                if chunk['type'] == 'text':\n                    thought += chunk['content']\n            return thought\n        except AuthenticationError as e:\n            raise AuthenticationError(\"Authentication failed. Please check your token.\") from e\n        except RateLimitError as e:\n            raise RateLimitError(\"Rate limit exceeded. Please wait before making more requests.\") from e\n        except CloudflareError as e:\n            raise CloudflareError(f\"Cloudflare protection encountered: {str(e)}\") from e\n        except NetworkError as e:\n            raise NetworkError(\"Network error occurred. Check your internet connection.\") from e\n        except APIError as e:\n            raise APIError(f\"API error occurred: {str(e)}\") from e\n        return None\n\n    def litellm_fn(self, history, verbose=False):\n        \"\"\"\n        Use LiteLLM AI gateway for completion.\n        Routes to 100+ providers (OpenAI, Anthropic, Azure, Bedrock,\n        Vertex AI, Groq, Together, Ollama, etc.) based on model prefix.\n        See https://docs.litellm.ai/docs/providers\n        \"\"\"\n        try:\n            import litellm\n        except ImportError as e:\n            raise ImportError(\"litellm is not installed. Install with: pip install litellm\") from e\n\n        if self.is_local:\n            raise Exception(\"LiteLLM is not available for local use. Change config.ini\")","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/llm_provider.py#L486-L522","documentation":"dsk_deepseek catches dsk's NetworkError and re-raises it with a fixed message telling the developer to check their internet connection. It means a socket/DNS/timeout-level failure occurred while talking to the free DeepSeek endpoint, before any API-level response was received.","triggerScenarios":"Calling LLMProvider.dsk_deepseek(history) when the underlying dsk API raises NetworkError during session creation or streaming chat_completion — DNS failure, connection refused/reset, TLS error, or read timeout.","commonSituations":"Offline machine or flaky Wi-Fi; corporate proxy/firewall blocking chat.deepseek.com; DNS misconfiguration; long streaming responses exceeding timeouts on unstable connections.","solutions":["Verify general connectivity (curl https://chat.deepseek.com) and DNS resolution","Check proxy/VPN/firewall settings and required HTTPS_PROXY env vars","Retry with backoff — transient network blips during streaming are common","Fall back to another provider backend (litellm_fn, etc.) in config.ini"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\ntry:\n    socket.create_connection(('chat.deepseek.com', 443), timeout=5)\nexcept OSError:\n    raise RuntimeError('No connectivity to DeepSeek endpoint')","typeGuard":"def is_network_error(e: BaseException) -> bool:\n    return isinstance(e, NetworkError)","tryCatchPattern":"import time\nfor attempt in range(3):\n    try:\n        thought = provider.dsk_deepseek(history)\n        break\n    except NetworkError:\n        if attempt == 2:\n            raise\n        time.sleep(2 ** attempt)","preventionTips":["Check connectivity and proxy env vars before starting long LLM pipelines","Use exponential backoff for transient network failures","Monitor DNS/VPN state in CI or containerized environments","Configure an alternate provider for offline resilience"],"tags":["network","connectivity","timeout","unofficial-api"],"backgroundTag":"network-request-failed","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}