Batch Task “Pretranslate”/ ”Word Count” API call fails randomly

After migrating to Trados Studio 2021 from SDL Trados Studio 2017, we have come across the following major issue in the implementation of our automated processes (using the Trados public APIs):

Batch Task “Pretranslate”/ ”Word Count”: randomly fails with the following exception:

“Unexpected exception when configuring file multiFileConverter for task 'Word Count': Failed to create an instance of translation provider 'sdltm.XXX/

“Unexpected exception when configuring file multiFileConverter for task 'Pre-translate Files': Failed to create an instance of translation provider 'sdltm.file:///P:/PathToTheTM/nameOfTheTm.sdltm'..”

 

This issue has been replicated on our side using a simple Filebased Project with 2 simple docx translatable files, an empty FileBased TM while running the batch task “Pretranslate” on a loop.

 

As you can see, this problem occurs both with FileBased and ServerBased TMs.

Through trial-and-error, we have noticed the following:

  • The problem occurs only with projects that have more than one translatable file.
  • The problem does not occur if the batch task is applied for each translatable file separately.
  • The problem will occur after running the task a couple of times. The first few times the task is run, there is no issue.
  • Once the problem occurs, it keeps occurring until either a long time has gone by or the PC is rebooted (even if after the problem occurs we try to run the batch task for each file separately).

Details of the Exception fetched From Visual Studio:

System.IndexOutOfRangeException

  HResult=0x80131508

  Message=Index was outside the bounds of the array.

  Source=Sdl.Core.PluginFramework

  StackTrace:

   at Sdl.Core.PluginFramework.ObjectRegistry`2.CreateObjects()

 

  This exception was originally thrown at this call stack:

    Sdl.Core.PluginFramework.ObjectRegistry<TExtensionAttribute, TExtensionType>.CreateObjects()

 

This is a serious issue with a major negative impact on our productivity.
Can anyone from RWS give me an official answer on what to do? This was working perfectly fine until the upgrade to Trados 2021.
Is this going to be fixed soon on an upcoming update?
Is there a way to circumvent the problem in the meantime?

Thank you in advance!


emoji
  • Hi   

    Having the complete stack trace error would be helpful. Can you please save it to this post for further assessment.


    In the meantime, I have moved this post to the relevant teams for their attention.

    Regards

    Lyds

    Lydia Simplicio | RWS Group

    _______
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • Hello ,

    I am attaching the requested information.

    Thank you very much for your actions.

    <SDLErrorDetails time="6/8/2022 11:43:32 AM">
    <ErrorMessage>Unexpected exception when configuring file multiFileConverter for task 'Pre-translate Files': Failed to create an instance of translation provider 'sdltm.file:///PathToTheTM/nameOfTheTm.sdltm'..</ErrorMessage>
    <Exception>
    <Type>Sdl.ProjectApi.ProjectApiException, Sdl.ProjectApi, Version=16.0.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888</Type>
    <HelpLink />
    <Source>Sdl.ProjectApi.Implementation</Source>
    <HResult>-2146233088</HResult>
    <StackTrace><![CDATA[ at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.ConfigureConverter(IMultiFileConverter multiFileConverter, Language targetLanguage)
    at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.CreateMultiFileConverter(IProjectFile tf, String filePath)
    at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.Parse(String targetFilePath)]]></StackTrace>
    <InnerException>
    <Type>Sdl.ProjectAutomation.Core.ProjectAutomationException, Sdl.ProjectAutomation.Core, Version=16.0.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888</Type>
    <HelpLink />
    <Source>Sdl.ProjectAutomation.FileBased</Source>
    <HResult>-2146233088</HResult>
    <StackTrace><![CDATA[ at Sdl.ProjectAutomation.FileBased.Internal.AutomationServerEvents.HandleTranslationProviderException(ITranslationProviderItem translationProviderItem, Exception exception)
    at Sdl.ProjectApi.Helpers.ProjectCascadeFactory.GetTranslationProviderLanguageDirection(ITranslationProviderItem translationProviderItem, LanguagePair languageDirection, Boolean performUpdate, Boolean refreshCache)
    at Sdl.ProjectApi.Helpers.ProjectCascadeFactory.CreateProjectCascadeEntries(IList`1 projectCascadeEntryDataList, LanguagePair languagePair, Boolean readOnly, Boolean refreshCache)
    at Sdl.ProjectApi.Helpers.ProjectCascadeFactory.CreateCascade(ProjectCascadeSettings projectCascadeSettings, Boolean refreshCache)
    at Sdl.ProjectApi.Helpers.LanguageDirectionHelper.CreateCascade(ILanguageDirection languageDirection, ProjectCascadeEntryDataFilterFunction filter, IComparer`1 sort, Boolean readOnly, Boolean refreshCache)
    at Sdl.ProjectApi.Helpers.LanguageObjectsCache.GetLanguageResources(ILanguageDirection languageDirection)
    at Sdl.ProjectApi.Helpers.LanguageObjectsCache.<>c__DisplayClass4_0.<GetLanguageResources>b__0(String _)
    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
    at Sdl.ProjectApi.Helpers.LanguageObjectsCache.GetLanguageResources(IProject project, Language language)
    at Sdl.ProjectApi.Helpers.LanguageObjectsCache.GetLanguageResources(ITranslatableFile file)
    at Sdl.ProjectApi.AutomaticTasks.AbstractContentProcessorTaskImplementation.AddSegmentorToConverter(IExecutingTaskFile executingTaskFile, IBilingualProcessorContainer multiFileConverter)
    at Sdl.ProjectApi.AutomaticTasks.AbstractTmContentProcessorTaskImplementation.ConfigureConverter(IExecutingTaskFile executingTaskFile, IMultiFileConverter multiFileConverter)
    at Sdl.ProjectApi.AutomaticTasks.Translate.TranslateTask.ConfigureConverter(IExecutingTaskFile executingTaskFile, IMultiFileConverter multiFileConverter)
    at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementation.TaskFileExecuter.ConfigureConverter(IMultiFileConverter multiFileConverter, Language targetLanguage)]]></StackTrace>
    <InnerException>
    <Type>System.IndexOutOfRangeException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
    <HelpLink />
    <Source>Sdl.Core.PluginFramework</Source>
    <HResult>-2146233080</HResult>
    <StackTrace><![CDATA[ at Sdl.Core.PluginFramework.ObjectRegistry`2.CreateObjects()
    at Sdl.LanguagePlatform.TranslationMemoryApi.TranslationProviderManager.GetTranslationProviderFactories()
    at Sdl.LanguagePlatform.TranslationMemoryApi.TranslationProviderManager.CreateTranslationProvider(Uri translationProviderUri, String translationProviderState, ITranslationProviderCredentialStore credentialStore)
    at Sdl.ProjectApi.TranslationProviderCache.CreateTranslationProvider(Uri translationProviderUri, String translationProviderState, ITranslationProviderCredentialStore credentialStore)
    at Sdl.ProjectApi.TranslationProviderCache.GetTranslationProvider(Uri translationProviderUri, String translationProviderState, ITranslationProviderCredentialStore credentialStore, Boolean performUpdate, Boolean refreshCache)
    at Sdl.ProjectApi.Helpers.ProjectCascadeFactory.GetTranslationProviderLanguageDirection(ITranslationProviderItem translationProviderItem, LanguagePair languageDirection, Boolean performUpdate, Boolean refreshCache)]]></StackTrace>
    </InnerException>
    </InnerException>
    </Exception>
    <Environment>
    <ProductName>Trados Studio</ProductName>
    <ProductVersion>Studio16</ProductVersion>
    <EntryAssemblyFileVersion>16.2.10.9305</EntryAssemblyFileVersion>
    <OperatingSystem>Microsoft Windows 10 Enterprise</OperatingSystem>
    <ServicePack>NULL</ServicePack>
    <OperatingSystemLanguage>1033</OperatingSystemLanguage>
    <CodePage>1252</CodePage>
    <LoggedOnUser>user</LoggedOnUser>
    <DotNetFrameWork>4.0.30319.42000</DotNetFrameWork>
    <ComputerName>ComputerName</ComputerName>
    <ConnectedToNetwork>True</ConnectedToNetwork>
    <PhysicalMemory>16776756 MB</PhysicalMemory>
    </Environment>
    </SDLErrorDetails>

    emoji
  • Hello again ,

    Researching, I also found this unresolved quesstion from two years ago by  which seems to have the same issue.

    community.rws.com/.../sdl-sdk-api-pretranslatefiles-randomly-fails

    Maybe it will assist your investigation.

    emoji
  • Thank you will see if the Trados AppStore Team can pick this up

    Lydia Simplicio | RWS Group

    _______
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • Hello Lydia,

    I would like to inquire if we have any news regarding the bug and if a fix is scheduled.

    It has been almost a month since it was reported, there is no update, and based on the lack of a resolution for the aforementioned similar bug I am getting worried that this one will be ignored too.
    As you may understand this is a pretty serious problem, halting our production and it only occurred after upgrading to Trados 2021.
    For the time being, we are forced to revert to Trados 2017, for each project that this bug occurs, making maintenance almost a nightmare (two different sets of software automations based on the edition of Trados).
    Please inform me.

    emoji
  • fyi:

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • Hi ,

    Thank you for reporting this issue.

    I have added an item on our board to followup + attempt to reproduce given the conditions that you have provided above.  I will circle back to you when I have more information.

    Internal Tracking id: SDLCOM-3739

    Note: I might reach out to you if I need more input or sample code.

    emoji
  • Hello  ,

    Thank you very much for taking an interest in the issue.

    Of course, I remain at your disposal if any further assistance of any kind can be provided.

    Please keep me updated.

    emoji
  • Hi,  !

    I added this code sample in which I automatically create projects from different folders using a template and place them all, pretranslated, in a new location.

    The way to use the app is by adding the following command line arguments when calling it:

    .\PretranslateProjectsCreatedFromTemplateSample.exe "<pathToTemplate>" "<pathToFolderWithTranslatatableFiles>" ... "<pathToFolderWithTranslatatableFiles>" "<pathToWhereTheProjectsWillBeCreated>" "<numberOfTimesTheOperationWillBeDone>" "s"

    You can add as many folders containing translatable files as you wish between the template path argument and the destination folder argument.

    The issue is not reproducible in this sample anymore.

    See if there's something different in the sample and add it to your code to test whether the issue still persists.

    emoji
  • Hello  ,

     

    Thank you for taking the time to answer.

    Unfortunately, the solution provided is really not a solution to the issue I am describing.

    First of all, it is not feasible to create a new project from a template when dealing with clients (clients usually send packages or projects with specific settings which should not overruled).

    Secondly, in your solution you do not run the batch tasks on a loop, which is where the issue lies; what you do is create projects on a loop.

    Once again, the issue lies in running multiple pre-translate tasks on a project.

    Please see this short code sample:

    https://bitbucket.org/t_kastanis/trados21issues/src/master/

    You can run the program with the following arguments in the command line:

    .\Trados2021.exe <PathToTheSdlprojFile> <timesToRunPretranslate>

    First, make a simple project manually with two or more files (NOT one) and add a simple TM file (it can even be empty), and then run the program.

    Make sure you add a big number to <timesToRunPretranslate> (e.g. 30) and run the program many times consecutively.

    Keep in mind, that running the “Pre-translate” task multiple times on an existing project is a key functionality to our workflow (and, I am guessing, other companies’ workflows). This means that this issue needs to be solved rather than patched with a workaround.

    Looking forward to your answer.

    emoji