System.IO.FileNotFoundException - However file is exist and open as well

Hi There,

Sometimes, we face the below error while running the process that uses Document Understanding. The error seems due to files are not available in a given location. However, we verified and came to know that the files exist and open successfully as well.

This error comes during the extraction of the data from the PDF activity. We have added retry logic as well along with 5 seconds delay. But still, we are receiving this error.

We also tried to replicate the issue in UAT/DEV for file not found exceptions items but files exist but all items were processing fine and completed successfully.

Error:
Reason: System.IO.FileNotFoundException: Could not find file “H:\SourcePhase3\E Docs Critical Mail Single2023090711425626195.pdf” at UiPath.PDF.Activities.PDF.ValidationHelper.ValidateInputFilePath(String filePath) at UiPath.PDF.Activities.PDF.ExtractPDFPageRange.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance

Specific Data: Object
TargetFile: H:\SourcePhase3\E Docs Critical Mail Single2023090711425626195.pdf
Output Data: null
Analytics Data: null

Can anybody help me to resolve the issue?

-With Best Regards,
Malak Dudhia

Hi @malak.dudhia

In the assign activity, try below expressions and pass result to for each loop to iterate one by one file.

Directory.GetFiles(“FolderPath”)

Hope it helps!!

Hi @Parvathy - Thank you for the reply.

However, we are providing input as a specific file path to extract the data from PDF with PDF activity.

@malak.dudhia

Try copying the path by clicking copy path of that particular file and paste it. Give the double quotes correctly.

Regards

@malak.dudhia

  1. Can you show the exact screenshot of specific content and the code where it is failing
  2. Try to use path.Combine(specific content here)
  3. If it is happening only for few files…then try extracting the queue items into json and check if there are any special characters that are being added to them

Cheers