{"record":{"id":"b06da6f2bf49eb18","repo":"eclipse-vertx/vert.x","slug":"422-unprocessable-entity-webdav-rfc4918","errorCode":null,"errorMessage":"422 Unprocessable Entity (WebDAV, RFC4918)","messagePattern":"422 Unprocessable Entity \\(WebDAV, RFC4918\\)","errorType":"http","errorClass":null,"httpStatus":422,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java","lineNumber":245,"sourceCode":"  /**\n   * 416 Requested Range Not Satisfiable\n   */\n  HttpResponseExpectation SC_REQUESTED_RANGE_NOT_SATISFIABLE = status(416);\n\n  /**\n   * 417 Expectation Failed\n   */\n  HttpResponseExpectation SC_EXPECTATION_FAILED = status(417);\n\n  /**\n   * 421 Misdirected Request\n   */\n  HttpResponseExpectation SC_MISDIRECTED_REQUEST = status(421);\n\n  /**\n   * 422 Unprocessable Entity (WebDAV, RFC4918)\n   */\n  HttpResponseExpectation SC_UNPROCESSABLE_ENTITY = status(422);\n\n  /**\n   * 423 Locked (WebDAV, RFC4918)\n   */\n  HttpResponseExpectation SC_LOCKED = status(423);\n\n  /**\n   * 424 Failed Dependency (WebDAV, RFC4918)\n   */\n  HttpResponseExpectation SC_FAILED_DEPENDENCY = status(424);\n\n  /**\n   * 425 Unordered Collection (WebDAV, RFC3648)\n   */\n  HttpResponseExpectation SC_UNORDERED_COLLECTION = status(425);\n\n  /**\n   * 426 Upgrade Required (RFC2817)","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java#L227-L263","documentation":"SC_UNPROCESSABLE_ENTITY is an HttpResponseExpectation constant for HTTP 422 (WebDAV, RFC4918). It signals a request was well-formed but semantically invalid, so the server refuses to process it. Vert.x exposes it so applications can assert or react to this status in HttpClient expectations.","triggerScenarios":"Sending a syntactically valid request whose body/fields fail server-side business validation, e.g. POST/PUT with invalid domain data to a REST API, or WebDAV operations violating semantic constraints. Observed when chaining .expecting(HttpResponseExpectation.SC_UNPROCESSABLE_ENTITY) or when an api expects success but the server replies 422.","commonSituations":"REST API request bodies failing server-side validation (missing/invalid fields, constraint violations); Rails-style APIs returning 422 for model validation failures; version changes where a server started enforcing new field constraints.","solutions":["Read the response body (usually contains validation error details) and fix the fields that failed server-side validation.","Validate the payload client-side before sending (schema/bean validation) to catch problems early.","Check API documentation or changelog for newly required fields after a server version upgrade.","If 421/422 are expected outcomes, model them explicitly with the corresponding expectation instead of expecting SC_OK."],"exampleFix":"// before\nclient.post(8080, \"localhost\", \"/users\").sendJsonObject(invalidBody)\n  .expecting(HttpResponseExpectation.SC_CREATED);\n// after\n// validate body first\nif (body.getString(\"email\") == null) { throw new IllegalArgumentException(\"email required\"); }\nclient.post(8080, \"localhost\", \"/users\").sendJsonObject(body)\n  .expecting(HttpResponseExpectation.SC_CREATED);","handlingStrategy":"validation","validationCode":"Set<String> missing = requiredFields.stream().filter(f -> body.getValue(f) == null).collect(Collectors.toSet());\nif (!missing.isEmpty()) throw new IllegalArgumentException(\"missing fields: \" + missing);","typeGuard":"boolean is422(HttpClientResponse resp) { return resp.statusCode() == 422; }","tryCatchPattern":"send()\n  .expecting(HttpResponseExpectation.SC_CREATED)\n  .onFailure(err -> { if (isCauseStatus(err, 422)) readErrorDetailsAndFixPayload(); });","preventionTips":["Validate payloads against the API schema before sending","Read 422 response bodies for field-level error details","Re-check required fields after server version upgrades","Keep client-side models in sync with server validation rules"],"tags":["http","validation","rest","vertx-http-client"],"backgroundTag":"http-error-status","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}