Import Fails with Form is larger than max length 10485760 After Upload

0
EnvironmentMendix local runtimeUser: MxAdminCSV file upload and import functionalityFile uploads successfully and is stored in a FileDocument entityImport button triggers a microflow that calls a Java action to read the CSV and convert it to JSONProblemThe file upload itself succeeds.After the upload is completed, I click Import, which executes my import logic (CSV → JSON conversion in a Java action).At that point I receive:Uploading file failed: 400: Unable to parse form contentand the runtime log contains:java.lang.IllegalStateException:Form is larger than max length 10485760FlowUser uploads CSV file.Upload completes successfully.User clicks Import.Microflow calls Java action.(csv to json)Error occurs before/during processing.QuestionI am confused because the file has already been uploaded successfully.If the document already exists in Mendix, why would pressing Import trigger:Plain TextForm is larger than max length 10485760Could Mendix be submitting the file again as part of the request?Or is there a runtime/request size limitation being hit when the Import action executes?Has anyone encountered this situation where:Upload succeedsImport button failsError references multipart/form content and 10 MB limitRelevant Errorjava.lang.IllegalStateException: Form is larger than max length 10485760 org.eclipse.jetty.http.BadMessageException:400: Unable to parse form contentAny guidance would be appreciated.My take from your descriptionIf the file is already uploaded and stored in a FileDocument, then your Java action (getContents, InputStream, CSV parsing, JSON conversion) normally should not cause a multipart upload error.That makes me suspect one of these:The page was never actually committing the file completely before Import.The Import button is inside the same Data View and causes the browser to submit the file again.A custom widget is re-uploading the file when Import is clicked.The stack trace mentions FileUploadHelper, which is unusual for pure CSV parsing and suggests Mendix is still handling an upload request.For debugging, I'd also tell the community:Mendix versionWidget used (File Manager, DropZone, File Dropper, etc.)Whether Import button triggers a microflow directlyWhether the uploaded file is already visible in the database/FileDocument table before Import is pressedThat detail will help identify whether this is truly your Java action or another upload request happening behind the scenes.
asked
2 answers
0

Hi Rajan,


Why it fails on Import


The upload is not actually finished when you see the file selected. With the File Manager inside a data view, Mendix only sends the file to the server when the form is submitted, and that happens right before a microflow is called or the page is saved. So clicking Import is the moment the file really gets uploaded.


That's why your stack trace goes through FileUploadHelper. Your Java action never even starts; the request fails while uploading.


What the error means


The request is bigger than the 10 MB form limit of the runtime (10485760 bytes), so your CSV plus the form overhead is over 10 MB. The Max File Size setting on the File Manager doesn't change this; even if you set it higher, this limit still applies.


How to fix it


1. Keep the CSV under 10 MB, for example by splitting large files, or zip it and unzip it in your Java action.

2. On Mendix Cloud this limit is a platform setting, so ask Mendix Support whether they can raise it for your environment.

3. To confirm, add a separate Save/Upload button that only commits the FileDocument. If that also fails with the same error, it's the upload size and not your import logic.


Side note


For big CSV files, read the contents as a stream in your Java action instead of loading the whole file into one string or one big JSON, otherwise you'll run into memory problems next.


Hope this helps. If it works for you, please mark the answer as accepted so others with the same issue can find it.


answered
0

Hi Rajan,


Based on the exception and the workflow you described, I would investigate the HTTP request handled by Mendix's file-upload mechanism before changing the CSV parsing Java action.

The exception:


java.lang.IllegalStateException: Form is larger than max length 10485760

indicates that the request's form content exceeds the configured 10 MiB parsing limit. The FileUploadHelper entries in the stack trace are particularly important because they point to file-upload handling.


Recommended troubleshooting and fix


Step 1: Identify the exact request that fails

  1. Open your application in Chrome.
  2. Press F12 and select the Network tab.
  3. Enable Preserve log.
  4. Upload the CSV and wait until the upload completes.
  5. Click Import.
  6. Find the failed request and inspect its URL, request method, status code, content type, and payload size.

Check whether the failed request is a file-upload request or the request that invokes your import logic.


Step 2: Check whether the file is being uploaded twice

If the upload request fails when you click Import, verify whether the page or a custom widget is submitting the CSV again.

If the file has already been uploaded and stored as a System.FileDocument, the import process should use that existing object. It should not send the entire CSV through the browser again.

If the Network tab confirms a duplicate upload, correct the button or widget flow so that Import operates on the existing FileDocument object.


Step 3: Pass the existing FileDocument to the import microflow

A suitable flow is:

Upload CSV → Store FileDocument → Click Import → Pass FileDocument to microflow → Read stored content → Parse CSV → Process records

For example:

  • Create or retrieve the existing FileDocument object.
  • Pass that object as a parameter to the import microflow.
  • Pass the same object to your Java action.
  • Read its content using the supported Mendix file-document API.
  • Parse the CSV from the resulting input stream and convert the records to JSON.

This avoids unnecessarily transmitting the entire file again during import.


Step 4: If the request is not a duplicate upload

If the failed request is the original upload, check the actual file size and the complete request payload. Multipart form data includes boundaries and additional fields, so the request size may be larger than the file alone.

If the CSV is smaller than 10 MiB but the request still exceeds the limit, inspect whether the request contains duplicated file content, Base64 data, or other large fields.

If the request is genuinely larger than the configured limit, review the supported request-size configuration for your specific Mendix runtime version and deployment type. Do not assume that changing a generic Jetty setting will override the limit used by the Mendix runtime.


Step 5: Test the corrected flow

Test with:

  • A small CSV file.
  • A CSV file close to the 10 MiB limit.
  • A larger CSV file, if your application is expected to support it.

Confirm that the file is uploaded once, the Import action receives the existing FileDocument, and the CSV parsing logic executes successfully.


Important conclusion

I would not change the CSV-to-JSON conversion code first. The stack trace indicates that the request is rejected during form parsing, but it does not yet prove whether the cause is a duplicate upload or an oversized original request.


Could you share the failing Network request's URL and the CSV file size? Those two details will help distinguish the two cases and identify the appropriate fix.


Reference: Mendix Community – Uploading file failed: 400 Unable to parse form content


Hope this helps!

answered