{"record":{"id":"6f237d09f28f7cab","repo":"oraios/serena","slug":"api-request-failed-with-status-response-status-co","errorCode":null,"errorMessage":"API request failed with status {response.status_code}: {response.text}","messagePattern":"API request failed with status (.+?): (.+?)","errorType":"exception","errorClass":"PluginServerError","httpStatus":null,"severity":"error","filePath":"src/serena/jetbrains/jetbrains_plugin_client.py","lineNumber":356,"sourceCode":"                return {\"response\": response.text}\n\n        except requests.exceptions.ConnectionError as e:\n            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]","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/jetbrains/jetbrains_plugin_client.py#L338-L374","documentation":"When the plugin returns an HTTP error that is NOT deemed recoverable (status != 400 for plugin >=2023.2.6, or response is None), _make_request raises PluginServerError('API request failed with status {status}: {body}'), surfacing the IDE-side error text.","triggerScenarios":"Plugin service responding 4xx/5xx other than 400 (e.g. 404 unknown endpoint for old plugin, 500 internal IDE error, 401/403) to calls like find_symbol, move, or get_symbols_overview.","commonSituations":"Plugin version mismatch so the endpoint path doesn't exist (404); IDE-internal exception during refactorings (500); plugin service bound but project closed on the IDE side.","solutions":["Read the response.text in the error — it usually contains the IDE-side stacktrace or message","Update the Serena plugin to match the client's expected API surface","Reopen the project in the IDE and retry","Report a plugin bug with the status code and body if 500 persists"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# no pre-call validation possible; log and inspect server-side details on failure\ndef describe(err: PluginServerError) -> str:\n    return str(err)  # contains HTTP status and response body from the IDE plugin","typeGuard":null,"tryCatchPattern":"try:\n    client.move(...)  # or other plugin op\nexcept PluginServerError as e:\n    log.error(\"Plugin HTTP failure: %s\", e)  # includes status code + body\n    if \"404\" in str(e):\n        suggest_plugin_update()\n    raise","preventionTips":["Keep the JetBrains plugin and serena client versions matched to avoid unknown endpoints","Read the error body — it contains the IDE-side cause","Reopen the project in the IDE if the service reports the project is missing","Report persistent 500s to the Serena plugin issue tracker with logs"],"tags":["jetbrains","http","api","server-error"],"backgroundTag":"http-5xx","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}