{"record":{"id":"f45ee4b8ccb3bdae","repo":"eclipse-vertx/vert.x","slug":"413-request-entity-too-large","errorCode":null,"errorMessage":"413 Request Entity Too Large","messagePattern":"413 Request Entity Too Large","errorType":"http","errorClass":null,"httpStatus":413,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java","lineNumber":215,"sourceCode":"  /**\n   * 410 Gone\n   */\n  HttpResponseExpectation SC_GONE = status(410);\n\n  /**\n   * 411 Length Required\n   */\n  HttpResponseExpectation SC_LENGTH_REQUIRED = status(411);\n\n  /**\n   * 412 Precondition Failed\n   */\n  HttpResponseExpectation SC_PRECONDITION_FAILED = status(412);\n\n  /**\n   * 413 Request Entity Too Large\n   */\n  HttpResponseExpectation SC_REQUEST_ENTITY_TOO_LARGE = status(413);\n\n  /**\n   * 414 Request-URI Too Long\n   */\n  HttpResponseExpectation SC_REQUEST_URI_TOO_LONG = status(414);\n\n  /**\n   * 415 Unsupported Media Type\n   */\n  HttpResponseExpectation SC_UNSUPPORTED_MEDIA_TYPE = status(415);\n\n  /**\n   * 416 Requested Range Not Satisfiable\n   */\n  HttpResponseExpectation SC_REQUESTED_RANGE_NOT_SATISFIABLE = status(416);\n\n  /**\n   * 417 Expectation Failed","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/HttpResponseExpectation.java#L197-L233","documentation":"SC_REQUEST_ENTITY_TOO_LARGE is the HttpResponseExpectation constant for HTTP 413 Content Too Large (historically 'Request Entity Too Large'). Vert.x provides it for response validation; when the server rejects an oversized request body, applying this expectation surfaces '413 Request Entity Too Large'. The request payload exceeds the size limit the server (or an intermediary) enforces.","triggerScenarios":"Uploading a file or sending a large JSON body via Vert.x WebClient/HttpClient to a server whose max body size (e.g. nginx client_max_body_size, Vert.x BodyLimit, Spring/Tomcat max-http-post-size) is smaller than the payload.","commonSituations":"File-upload endpoints behind nginx/ingress with default 1MB limits, large batch API calls exceeding provider limits, misconfigured maxBodySize on a Vert.x reverse proxy, test fixtures with large payloads hitting prod limits.","solutions":["Split or chunk the payload into smaller requests within the server's limit","Increase the limit on the server/ingress (e.g. nginx client_max_body_size, proxy maxBodySize) if the size is legitimate","Compress the body (gzip) and send with Content-Encoding if the API supports it","Switch to a resumable/multipart upload API for large files","Check response headers/error body for the exact limit the server reports"],"exampleFix":"// before\nwebClient.post(url).sendBuffer(hugeBuffer); // 413\n// after\nfor (Buffer chunk : split(hugeBuffer, MAX_CHUNK)) {\n  webClient.post(url + \"/chunk\").sendBuffer(chunk);\n}","handlingStrategy":"validation","validationCode":"// Guard client-side before upload\nif (buffer.length() > MAX_UPLOAD_BYTES) {\n  throw new IllegalArgumentException(\"payload \" + buffer.length() + \" exceeds \" + MAX_UPLOAD_BYTES);\n}","typeGuard":"boolean isPayloadTooLarge(Throwable t) {\n  return t instanceof VertxHttpResponseException\n    && ((VertxHttpResponseException) t).getResponse().statusCode() == 413;\n}","tryCatchPattern":"if (isPayloadTooLarge(t)) { splitAndUploadInChunks(); } else { throw t; }","preventionTips":["Enforce the server's documented size limit client-side","Chunk or compress large payloads proactively","Use resumable upload APIs for files","Learn the actual limit from a 413 response body and store it in config"],"tags":["http","payload-too-large","upload","limit"],"backgroundTag":"payload-too-large","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"}