Strange error during invoking post.post_process script

During uploading file to S3 (this works ok), system gives me error:

POST https://localhost:8880/rest/s3/dreamfile/ 500 (Internal  Server  Error)
Dream_app:502 {"readyState":4,"responseText":"{\"error\":[{\"context\":null,\"message\":\"Exception executing javascript: SyntaxError: Unexpected token ;\",\"code\":500}]}","status":500,"statusText":"Internal  Server  Error"}

but I don’t have any additional semicolon.
For test purposes I added to script only single line:

var test;

I suppose this is system error, because 

and I have only one line in my code.

I have created the same post.pre_process script on a file storage service and can’t get the same result.

Are you certain you’re editing the right script file? You mentioned is just a single line, but the error message indicates line 63 of

I get the same(very similar error) when I add either a post.pre_process or a post.post_process script. I have less than 10 lines of code.

Here is the error from the web.*.log file:

[ERROR    ] REST Exception #500 > Exception executing javascript: SyntaxError: Unexpected token ; {"host":"","request_uri":"/rest/files/applications/app/?check_exist=false","source_ip":"","sapi_name":"apache2handler"} 

Some background:
I am trying to upload files via the files api and the android sdk. without the scripts, file uploads of any kind are successful. However, pictures(.jpg) files result in the above error when either script type is enabled. I have not tried other image formats.

After doing some troubleshooting, I realized that the contents of the script did not matter. Having even empty scripts caused .jpg uploads to fail with the same exact error above.

Any solutions/workarounds?