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:



  Message=Index was outside the bounds of the array.



   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!

  • 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.



  • 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>
    <Type>Sdl.ProjectApi.ProjectApiException, Sdl.ProjectApi, Version=, Culture=neutral, PublicKeyToken=c28cdb26c445c888</Type>
    <HelpLink />
    <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>
    <Type>Sdl.ProjectAutomation.Core.ProjectAutomationException, Sdl.ProjectAutomation.Core, Version=, Culture=neutral, PublicKeyToken=c28cdb26c445c888</Type>
    <HelpLink />
    <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>
    <Type>System.IndexOutOfRangeException, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
    <HelpLink />
    <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>
    <ProductName>Trados Studio</ProductName>
    <OperatingSystem>Microsoft Windows 10 Enterprise</OperatingSystem>
    <PhysicalMemory>16776756 MB</PhysicalMemory>

  • Hello again ,

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

    Maybe it will assist your investigation.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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:

    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.