{"record":{"id":"1e10740b1cbff197","repo":"oraios/serena","slug":"request-failed-e","errorCode":null,"errorMessage":"Request failed: {e}","messagePattern":"Request failed: (.+?)","errorType":"exception","errorClass":"SerenaClientError","httpStatus":null,"severity":"error","filePath":"src/serena/jetbrains/jetbrains_plugin_client.py","lineNumber":359,"sourceCode":"            raise ConnectionError(f\"Failed to connect to Serena service at {url}: {e}\")\n        except requests.exceptions.Timeout as e:\n            raise ConnectionError(f\"Request to {url} timed out: {e}\")\n        except requests.exceptions.HTTPError as e:\n            if response is not None:\n                # check for recoverable error (i.e. errors where the problem can be resolved by the caller or\n                # other errors where the error text shall simply be passed on to the LLM).\n                # The plugin returns 400 for such errors (typically illegal arguments, e.g. non-unique name path)\n                # but only since version 2023.2.6\n                if self.is_version_at_least(2023, 2, 6):\n                    is_recoverable_error = response.status_code == 400\n                else:\n                    is_recoverable_error = True  # assume recoverable for older versions (mix of errors)\n                if is_recoverable_error:\n                    raise APIError(response)\n                raise PluginServerError(f\"API request failed with status {response.status_code}: {response.text}\")\n            raise PluginServerError(f\"API request failed with HTTP error: {e}\")\n        except requests.exceptions.RequestException as e:\n            raise SerenaClientError(f\"Request failed: {e}\")\n\n    @staticmethod\n    def _pythonify_response(response: T) -> T:\n        \"\"\"\n        Converts dictionary keys from camelCase to snake_case recursively.\n\n        :response: the response in which to convert keys (dictionary or list)\n        \"\"\"\n        to_snake_case = lambda s: \"\".join([\"_\" + c.lower() if c.isupper() else c for c in s])\n\n        def convert(x):\n            if isinstance(x, dict):\n                return {to_snake_case(k): convert(v) for k, v in x.items()}\n            elif isinstance(x, list):\n                return [convert(item) for item in x]\n            else:\n                return x\n","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/jetbrains/jetbrains_plugin_client.py#L341-L377","documentation":"The final catch-all in _make_request: any other requests.exceptions.RequestException (not ConnectionError/Timeout/HTTPError — e.g. TooManyRedirects, ChunkedEncodingError, InvalidURL) is re-raised as SerenaClientError('Request failed: {e}').","triggerScenarios":"Unusual requests-library failures during plugin API calls — malformed service URL, too many redirects, response decoding errors — from client init or symbol/reference operations.","commonSituations":"Bad discovered service URL (whitespace/garbage port); proxy misconfiguration; interrupted local HTTP stream when the IDE is killed mid-response.","solutions":["Inspect the wrapped exception message for the underlying cause","Re-run from_project to rediscover a valid service URL","Fix proxy environment variables affecting localhost","Restart the IDE and retry the operation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# validate the discovered service URL before use\nfrom urllib.parse import urlparse\ndef valid_service_url(url: str) -> bool:\n    p = urlparse(url)\n    return p.scheme in (\"http\", \"https\") and bool(p.hostname) and p.port is not None","typeGuard":null,"tryCatchPattern":"try:\n    client = JetBrainsPluginClient.from_project(project)\n    refs = client.find_references(name_path=\"Foo\")\nexcept SerenaClientError as e:\n    if \"Request failed\" in str(e):\n        log.error(\"Underlying requests error: %s — rediscover service and retry\", e)\n        client = JetBrainsPluginClient.from_project(project)\n    else:\n        raise","preventionTips":["Inspect the wrapped cause in the message (InvalidURL, TooManyRedirects, etc.)","Fix proxy/redirect env settings for localhost traffic","Rediscover the service URL after IDE restarts","Catch SerenaClientError as the umbrella type for all plugin client failures"],"tags":["network","jetbrains","http","requests"],"backgroundTag":"request-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}