I have a webform (also tried with a custom module form and got the same error) with a Document file field and a Captcha field. When the user uploads a valid file (the file is autouploaded) I get a 502 error in the ajax call and wathing the logs I see this error: PHP message: AssertionError: Cannot load the "captcha_point" entity with NULL ID and the file is not uploaded.
I have tried to add a captcha_point for that webform (using the value in the form_id hidden input) but that didnt solve the problem neither.