This can occur for several reasons:
Be sure your file permissions are correct. If the file needs to be written to it needs to be set to 777.
Make sure the localhost call is correct.
If it is having difficulty connecting to a remote site this can occur.
Some form data can trigger the above error. A work around can be to pre-encode the textarea before POST.
Check your folder's error_log file for additional information.