Document is invalid - Workflow

Hello,

I have created a workflow and tested with no issues. Later when I try to open the workflow receiving “Document is invalid” and not able to continue. Below the error message receiving. I have tried to delete project.json and no luck. Any help would be greatly appreciated.

18.4.3+Branch.master.Sha.9888b477be8d3ec8a832306fc59c34ba6edad108

Document is invalid

Open Document Error: UiPath.Studio.Contracts.RecoverableException —> UiPath.Studio.Contracts.RecoverableException: The item ‘C:\Users\urayalla\Documents\GITrepository\RPA01\Processor\Processors\NJ HO Policy Renewal\Decision Action\Coverages.xaml’ could not be opened: Document is invalid. —> System.IO.InvalidDataException: Document is invalid
at UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerWrapper.InitRootActivity(String filename) in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\WorkflowHandling\DesignerWrapperInit.cs:line 247
at UiPath.Studio.Plugin.Workflow.WorkflowHandling.DesignerWrapper.Load(String fileName) in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\WorkflowHandling\DesignerWrapperInit.cs:line 72
at UiPath.Studio.Plugin.Workflow.Services.DesignerFileService.<>c__DisplayClass10_0.b__0() in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\Services\DesignerFileService.cs:line 107
at UiPath.Studio.Shared.MVVM.Services.DispatcherExtensions.Invoke(Dispatcher dispatcher, Action action, Boolean onlyBeginInvokeWhenNoAccess) in D:\a\1\s\Studio\UiPath.Studio.Shared\MVVM\Services\Extensions\DispatcherExtensions.cs:line 121
at UiPath.Studio.Shared.MVVM.Services.DispatcherService.Invoke(Action action, Boolean onlyInvokeWhenNoAccess) in D:\a\1\s\Studio\UiPath.Studio.Shared\MVVM\Services\DispatcherService.cs:line 165
at UiPath.Studio.Plugin.Workflow.Services.DesignerFileService.Load(String fileName) in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\Services\DesignerFileService.cs:line 88
at UiPath.Studio.Plugin.Workflow.Services.Interfaces.IDesignerFileService.Load(String fileName)
at UiPath.Studio.Plugin.Workflow.Services.DesignerFileServiceProxy.Load(String fileName) in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\Services\Proxies\DesignerFileServiceProxy.cs:line 20
at UiPath.Studio.Plugin.Workflow.WorkflowDocument…ctor(String path, IDesignerFileService designerFileService, IExtendedFileSystem fileSystem, IDesignerViewService designerViewService) in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\Document\WorkflowDocument.cs:line 53
at UiPath.Studio.Plugin.Workflow.WorkflowDocumentFactory.OpenAsync(String path) in D:\a\1\s\Studio\UiPath.Studio.Plugin.Workflow\Document\WorkflowDocumentFactory.cs:line 253
at UiPath.Studio.Shell.Services.PersistableServiceBase3.<OnOpenAsync>d__15.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\PersistableServiceBase.cs:line 178 --- End of inner exception stack trace --- at UiPath.Studio.Shell.Services.PersistableServiceBase3.d__15.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\PersistableServiceBase.cs:line 188
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shell.Services.DocumentService.d__45.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\DocumentService.cs:line 353
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shell.Services.PersistableServiceBase`3.d__8.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\PersistableServiceBase.cs:line 0
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shell.Services.OpenCloseCommandsService.d__17.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\OpenCloseCommandsService.cs:line 208
— End of inner exception stack trace —
at UiPath.Studio.Shell.Services.OpenCloseCommandsService.d__17.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\OpenCloseCommandsService.cs:line 213
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shell.Services.OpenCloseCommandsService.d__14.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\Services\OpenCloseCommandsService.cs:line 104
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shell.ApplicationStartup.d__14.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\ApplicationStartup.cs:line 179
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Studio.Shell.ApplicationStartup.<b__29_0>d.MoveNext() in D:\a\1\s\Studio\UiPath.Studio.Shell\ApplicationStartup.cs:line 443
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

Hi @Udayrayalla

I’m afraid something must have went bad when the file was being saved. Please navigate to the path and open the file in any text editor (Notepad or Notepad++):

C:\Users\urayalla\Documents\GITrepository\RPA01\Processor\Processors\NJ HO Policy Renewal\Decision Action\Coverages.xaml’ could not be opened: Document is invalid.

You can also create a new .xaml file in a new project, open it as well and then compare the two. It might be that you will still be able to salvage your corrupted file by making some manual changes, but there is no guarantee.

If all else fails, you will have to recreate the file.

After opening the file in a text editor, is there anything specifically that you can change in order to get rid of the error?

Hi @NischalV

Not sure about your particular situation. The easiest way is to create a new project and them compare your old file with the new one for differences.

Hi @loginerror ,

I am getting the same error. It could help us if there is a copy/backup file created when such situation occurs. My 2 months project is gone now. We were unable to deliver BOT now as promised.

Any work around has been found to recover? That would help us a lot.

Thanks,
Devi

2 Likes

Hi @Devi_Raji

I would advise you to try and open the project files in Notepad++ to see what is wrong with them. As mentioned above, you could create a new project to be able to compare the code of your files with the code of the new project files.

In the end, xaml files are simple text files.

@Devi_Raji,
looks like your dependencies json file might have corrupted.
Please take back of all script into different folder as a first step.
after that, please close all UiPath studio and delete your .Json file and re open xaml file.
It will automatically create new .json file.

This will fix your issue. please keep us post if you still face the same issue.

Hey @rkelchuri ,

No Luck. New file got created though. Still Main xaml file is zero kb.

Thanks,
Devi

Hey @loginerror ,

Thanks for the response. Did this, but when opened in Notepad ++, the file is empty.

This is tricky. Did you maybe publish your project in the past? If yes, and then you run your project, then there is a chance that the project folder is now also saved here:
%userprofile%\.nuget\packages

It would also help to know when exactly did this error start to occur.

2 Likes

Is there any solution to this? i lost one of my important workflow to this error. Recovering it is important.

no source control mostly pain solution guys.

It just gets corrupted somehow, if you use some version control software alongside, get the latest version from there or complete pain to resolve.

hi @Udayrayalla

I faced the same issue but had no luck. If you have published the code in the orchestrator then you can download the pervious package and desterilize the nupkg file.

To desterilize the nupkg file, just rename the file and change extension of the file to “.zip”. Then you can get the pervious version.

Hope this helps. Cheers.

I can’t open my latest workflow file and found error The item .xaml could not be opend: Document is invalid
Solution:
I compared header of my latest and the previous version, there are no this:WorkflowName.Arguments="" ... in the previous version. I removed all of the this:WorkflowName.Arguments="" ... in latest version (So header of my latest and the previous version are same) and then I can open file as normal.

1 Like

where is this header option?

@George_Ken

Open the xaml in notepad or any word editor and you can find thest

Rename Project.json file to Project_json.old
Try this for one time @Anil_G suggested me this trick & it works for me.

Try Removing the unsupported, un official and un used dependency packages of the project which are installed. and try to reopen the xaml