Second managed_file upload field fails with "An unrecoverable error occurred" I have a form with two (ajax enabled) upload fields.

Submitting a file to the first one works, then submitting a file to the 2nd does not, giving 


  An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (20 MB) that this server supports.


(the "likely exceeded" bit is wrong in this instance)

Looking at the code and the network requests it looks like the first is POSTed to a URL including the form build ID, and includes the same build ID in the POST body data. The second is posted to the same URL, however the result of uploading the first is that the form's hidden build id has changed -this is why the code in file.module rejects it and issues this error.

Thing is, I believe this has been working until recently (perhaps a recent upgrade of Drupal 7?) as I'm only getting these reports now but the code has been unchanged for at least a year.

Any suggestions?

(Drupal 7.69)
I'm the OP: This is not a full answer, but a fix:

Forcing the session to start with $_SESSION['something'] = 1; in the form build seems to cure this problem.

If you can provide better answers please do.