InteropServices.COMException (0x800A16A0): The file appears to be corrupted

I am encountering a weird scenario from a production bot process. I get the following Exception from the process:

System.Runtime.InteropServices.COMException (0x800A16A0): The file appears to be corrupted.
at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

This has been sporadic - it worked perfectly at first, and then random with the message above. Now it seems they all fail with the message above.

This process uses both Word and Excel documents, and it appears that the process is failing on an append range to an excel document. I can take all of the same files from production and run them locally on my machine with no problem or issues.

Has anyone seen this before and do you have any suggestions to resolve? Thanks.

If your excel is opened internally in that case you might get this type of exception. Instead of using excel application scope you can tryout with workbook.

Hey @jlock

Just a quick question - are you accessing files which has been used or opened by other users?
and it is windows server ?

Regards…!!
Aksh

1 Like

The file is being updated each occurrence the bot runs to append range to an excel spreadsheet keeping track of success or failure of the process. I have copied the excel file to my local machine and it works.

In order to get this to work, I renamed the folder I had holding all my word/excel documents I was working with in the bot process. I then created a new folder as the folder before and copied over all the contents to this new folder. It now processes everything successfully.

There must be some kind of issue internal to UIPath that is holding a connection to the old folder and causing it to think it is corrupt. I have not been able to explain it.