Submission upload error: Premature end of Content-Length delimited message body

What is the problem? Please be detailed.
Currently, submitting records with media files to using ODK Collect v1.17.0 is failing with the error Error: Generic Exception: Premature end of Content-Lenght delimited message body (expected: 114; received: 0). See screenshot below. Submissions without media files are uploading just fine on the same version of ODK Collect.

What ODK tool and version are you using? And on what device and operating system version?
ODK Collect v1.17.0,
Android version 6.0.1
Samsung DUOS

What steps can we take to reproduce the problem?
Try collecting data that includes media files - Use the test form attached below.

What you have you tried to fix the problem?
I downgraded to the previous version of ODK Collect v1.16.4 then tried submitting my data which was uploaded successfully. Submission took pretty long though. About a minute. The forms are very simple.

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Media_files.xlsx (14.8 KB)


@LN, @Grzesiek2010, @yanokwa Your assistance on the above issue will be highly appreciated. It's affecting quite a number of users in Ona.

I can't reproduce on Aggregate or Central, even with 30mb+ attachments but can with Ona even with very small attachments. Confirmed that the recent HTTP refactor is where the problem starts occurring.

Kobo works as well so it has something to do with changes made after that split or some kind of configuration difference. I don't see any evidence of a redirect when tracing the call but do you have something like a load balancer in place? Anything else possibly unusual about how Ona is hosted that we should know about?

Issue tracked at

What troubleshooting have you done on your end?

This seems to be a server issue. Uploads that take seconds to Central do take much longer to Ona or Aggregate.

1 Like

The change on Collect's end was that Authorization requests were not being sent with POSTs. Presumably, Ona handles single part and multipart posts differently and the multipart code can't handle retry attempts. I would recommend addressing that on Ona's end.

Collect v1.17.1 is now rolling out and does send the headers.

Thanks for the quick turnaround on this, @LN!

@kaymutua, we only test releases against Aggregate, so it's important that Ona staff participate in the Collect betas, review the release notes that detail the changes, and test against your server. If that's not being done now, I'd love to understand how we can work together to make that process easier.

1 Like

Thank you @LN and @yanokwa for looking into the issue. I will raise this with the engineering team for resolution. Regarding the Collect betas, we only participated once when the SMS submission feature was being rolled out. I will commit to testing the ODK Collect beta releases on our end.


That's great, @kaymutua! In general, I would recommend reviewing the beta release notes looking specifically for changes related to networking and/or features that may be implemented slightly differently in Ona because those are the ones that are likely to affect your users and not the rest of the ODK community. That way you can target your verification and it shouldn't take very long. We try to be very clear about what those changes are.

You can also check out the testing checklist that each revision goes through at If there are general cases not specifically related to Ona networking that you think are missing, please let us know and we can make sure those are added.

The networking changes implemented in 1.17.x are the first part of a networking library update. 1.18.x will also contain networking changes to finalize that update so I would recommend you plan on verifying that beta with Ona with and without attachments.