{"record":{"id":"ff1f5a6f7933b7bd","repo":"quarkusio/quarkus","slug":"bad-state","errorCode":null,"errorMessage":"bad state","messagePattern":"bad state","errorType":"http","errorClass":"HandledResponseEntityException","httpStatus":null,"severity":"error","filePath":"integration-tests/spring-web/src/main/java/io/quarkus/it/spring/web/ExceptionThrowingController.java","lineNumber":38,"sourceCode":"\n    @GetMapping(path = \"/unhandled/runtime\")\n    public String stringWithUnhandledAnnotatedRuntimeException() {\n        throw new UnhandledAnnotatedRuntimeException();\n    }\n\n    @GetMapping(\"/runtime\")\n    public void voidWithRuntimeException() {\n        throw new RuntimeException();\n    }\n\n    @GetMapping(\"/unannotated\")\n    public void voidWithUnannotatedException() {\n        throw new HandledUnannotatedException();\n    }\n\n    @GetMapping(\"/re/re\")\n    public ResponseEntity<Greeting> responseEntityWithResponseEntityException() {\n        throw new HandledResponseEntityException(\"bad state\");\n    }\n\n    @GetMapping(\"/re/pojo\")\n    public Greeting pojoWithResponseEntityException() {\n        throw new HandledResponseEntityException(\"bad state\");\n    }\n\n    @GetMapping(\"/re/void\")\n    public void voidWithResponseEntityException() {\n        throw new HandledResponseEntityException(\"bad state\");\n    }\n\n    @GetMapping(\"/re/void/xml\")\n    public void voidWithResponseEntityExceptionAsXml() {\n        throw new HandledResponseEntityException(\"bad state\", MediaType.APPLICATION_XML);\n    }\n\n    @GetMapping(\"/pojo/re\")","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/spring-web/src/main/java/io/quarkus/it/spring/web/ExceptionThrowingController.java#L20-L56","documentation":"responseEntityWithResponseEntityException throws HandledResponseEntityException('bad state') from an endpoint whose return type is ResponseEntity<Greeting>. 'Handled' means a mapper exists that converts it into an error ResponseEntity — typically HTTP 409/500 carrying the message — and this endpoint tests that mapping for the ResponseEntity return type.","triggerScenarios":"GET /exception/re/re — the method unconditionally throws HandledResponseEntityException; any invocation produces the mapped error response.","commonSituations":"Integration tests of Spring-Web compatibility exception handling; verifying that ResponseEntity-returning handlers get the mapped error body/status rather than a raw 500.","solutions":["Expect the mapped error response (check status/body in tests) — do not try to avoid the throw on this endpoint","Ensure an exception mapper for HandledResponseEntityException is registered if you get a raw 500 instead","Keep thrown messages stable ('bad state') as tests likely assert on them"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Response resp = given().get(\"/exception/re/re\");\nif (resp.statusCode() >= 400) {\n    // mapped HandledResponseEntityException('bad state') response\n}","preventionTips":["Verify a mapper for HandledResponseEntityException exists before shipping","Assert both status and body message ('bad state') in integration tests","Test exception handling for each return type: ResponseEntity, POJO, void"],"tags":["spring-web","resteasy","exception-mapping","response-entity"],"backgroundTag":"handled-exception-mapping","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}