Getting "Unexpected exception when initializing task 'Analyze Files': Object reference not set to an instance of an object" When Creating Projects

Hi, I'm frequently getting "Unexpected exception when initializing task 'Analyze Files': Object reference not set to an instance of an object" error when creating projects lately. Here is the error report:

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

At first, I though it was because of my TM and/or TB, so I changed to brand new TM and TB to test and still get the same error. I've tried to fix installation of my Trados Studio 2021, yet that did not fix the issue. 

Please help. 



Moved the error stack to code
[edited by: Paul at 5:24 PM (GMT 1) on 13 Jul 2023]
emoji
Parents
  •  

    Thank you for the stack trace error. So very helpful

    What I am noting in the stack trace is: Sdl.ProjectApi.Implementation; Sdl.LanguagePlatform.TranslationMemoryApi and initializing task 'Analyze Files

    I assume this was not a problem before, so what has changed?


    Please can you confirm:

    • What happens if you were to translate a single document, can you run the analysis?
    • And if you were creating a new project/using a project template, what happens if you disable your TM's?
    • What format are your TM's in?

    Thank you for the clarifications

    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
  • Hi Lydia,

    1. Creating a project with a single document works fine. I can run analysis. But I create projects with hundreds of files most of the time in my daily work. 

    2. As I mentioned, I tried creating projects by disabling my TM, disabling my TB, creating a project using the default template, new template, new TM, new TB, I got all the same error. 

    3. My TM is of course .sdltm file. 

    This error, often companies the following error on one or all of the files, happens too often lately, like 9 out of 10 when I create the same project with the same source files repeatedly. I get a project created successfully after dozens of "reprepare the project":

    <SDLErrorDetails time="7/17/2023 9:24:17 AM">
    <ErrorMessage>Unexpected exception when configuring file multiFileConverter for task 'Apply PerfectMatch': Collection was modified; enumeration operation may not execute..</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>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
    <HelpLink />
    <Source>mscorlib</Source>
    <HResult>-2146233079</HResult>
    <StackTrace><![CDATA[ at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
    at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
    at System.Collections.Generic.List`1.Enumerator.MoveNext()
    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundle.GetEntity(LanguageResourceType languageResourceType)
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundle.RemoveEntity(LanguageResourceType type)
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundle.RemoveEntities(LanguageResourceType[] types)
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundle.SaveDateTime()
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundle.SaveToEntities()
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundleCollection.SaveToEntities()
    at Sdl.LanguagePlatform.TranslationMemoryApi.LanguageResourceBundleCollection.get_ResourceDataAccessor()
    at Sdl.ProjectApi.Helpers.LanguageObjectsCache.<>c__DisplayClass7_0.<GetTokenizer>b__0(String _)
    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
    at Sdl.ProjectApi.Helpers.LanguageObjectsCache.GetTokenizer(ITranslatableFile file)
    at Sdl.ProjectApi.AutomaticTasks.AbstractContentProcessorTaskImplementation.GetTokenizer(IExecutingTaskFile executingTaskFile)
    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>
    </Exception>
    <Environment>
    <ProductName>Trados Studio</ProductName>
    <ProductVersion>Studio16</ProductVersion>
    <EntryAssemblyFileVersion>16.2.12.9338</EntryAssemblyFileVersion>
    <OperatingSystem>Microsoft Windows 10 Enterprise</OperatingSystem>
    <ServicePack>NULL</ServicePack>
    <OperatingSystemLanguage>1033</OperatingSystemLanguage>
    <CodePage>1252</CodePage>

    <DotNetFrameWork>4.0.30319.42000</DotNetFrameWork>

    <ConnectedToNetwork>True</ConnectedToNetwork>
    <PhysicalMemory>32324024 MB</PhysicalMemory>
    </Environment>
    </SDLErrorDetails>

    I tried to "repair the installation" of Trados, too, didn't solve the problem, though.

     

    emoji
  •  

    The reason your post went to spam is most likely because you keep posting the errors as text in the thread, so the forum seems this as a potential spam attack.  If you attach the file, or insert it using the Insert menu, Insert => Code => XML, then it's not only easier to read but it stands a better chance of avoiding the spam filters:

    Screenshot showing how to use the forum to insert a code sample, or an error stack.

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    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
  •  

    Great that file based projects work vs create project via the wizard.
    That most certainly points us in the direction we need to get the root caused looked into.

    One area to compare between your "default" settings of Trados Studio (File/Options) vs what you have as a template when creating your projects is the Match Repair settings.

    I have seen this error linked to cases "Match Repair with Termbases" where enabled. So my advice is to test with it disabled 

    Trados Studio Match Repair settings showing 'Termbases' option toggled off.

    Looking forward to the outcome of your findings

    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


    Generated Image Alt-Text
    [edited by: Trados AI at 11:50 AM (GMT 0) on 29 Feb 2024]
  •   

    Given the steps you've already tried, it's clear you've been thorough in trying to narrow down the issue.  Here are a few things that could potentially be at play, based on the details you provided:

    1. Concurrency issues due to the large number of files: The fact that the problem occurs primarily with large projects involving hundreds of files could indicate a concurrency issue. Trados Studio uses multi-threading to process multiple files simultaneously. In a multi-threaded environment, timing issues could cause a collection to be modified while it is being enumerated. A single file would likely not trigger such a condition, whereas hundreds of files might.

    2. Memory or resource limitation: While your machine seems to have plenty of memory, it's possible that there's some kind of resource limitation or conflict, perhaps related to disk I/O, that's only becoming apparent with a large number of files.

    3. Issues with the Translation Memory (TM) or Termbase (TB) files: You mentioned that you've tried disabling these and using new ones, but it might still be worth double-checking their integrity.  It's also worth considering whether the TM or TB files become locked or inaccessible at some point during the project creation process.  This might explain why the problem is intermittent.

    On the last point... I'd also look at whether you are sharing these resources with others, or whether you have them on OneDrive or similar for example as this could be where you get locking issues as a result of synching problems, especially when dealing with larger projects where these resources could be getting called for longer periods of time.

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

    Given the steps you've already tried, it's clear you've been thorough in trying to narrow down the issue.  Here are a few things that could potentially be at play, based on the details you provided:

    1. Concurrency issues due to the large number of files: The fact that the problem occurs primarily with large projects involving hundreds of files could indicate a concurrency issue. Trados Studio uses multi-threading to process multiple files simultaneously. In a multi-threaded environment, timing issues could cause a collection to be modified while it is being enumerated. A single file would likely not trigger such a condition, whereas hundreds of files might.

    2. Memory or resource limitation: While your machine seems to have plenty of memory, it's possible that there's some kind of resource limitation or conflict, perhaps related to disk I/O, that's only becoming apparent with a large number of files.

    3. Issues with the Translation Memory (TM) or Termbase (TB) files: You mentioned that you've tried disabling these and using new ones, but it might still be worth double-checking their integrity.  It's also worth considering whether the TM or TB files become locked or inaccessible at some point during the project creation process.  This might explain why the problem is intermittent.

    On the last point... I'd also look at whether you are sharing these resources with others, or whether you have them on OneDrive or similar for example as this could be where you get locking issues as a result of synching problems, especially when dealing with larger projects where these resources could be getting called for longer periods of time.

    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
Children
  •  , could you suggest what to do with No. 1 and 2? I'm working on a ThinkPad T14 laptop with AMD Ryzen 7 5850U and 32GB RAM, Win10. My TM and TB are both on my local drive. 

    Two weeks ago, I fixed my Autosuggest dictionary and the problem was gone, somehow today it all came back, with error stack below:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    emoji
  •  

    It's hard to be sure but it looks as though some resource is missing from your project settings.  I suggest you go through your project templates and make sure they contain all the resources they are connecting to, and especially that these resources are accessible.  So remove them and try and put them back.  Just because they are on your local drive doesn't mean they can always be accessed.  For example, if you do use OneDrive or something like this you still put files on your local drive but depending on the settings you use for OneDrive they won't always stay local.

    Here's an explanation of why.

    When you save a file locally to your OneDrive folder and if OneDrive Files On-Demand is enabled, it will immediately start to sync to the cloud. During this process, the file will have a status of "Sync pending" represented by circular arrows.

    Once the file is fully uploaded, if you haven't set the file to be "cloud-only" yet, it will be both on your local device and in the cloud. Its status will be represented by a green checkmark in a white circle, indicating that it's available both locally and online.

    However, if you manually set the file to be "cloud-only" by right-clicking on the file and choosing "Free up space", then OneDrive will remove the local copy of the file, and the file status will change to a blue cloud icon, indicating the file is now "cloud-only". When you do this, the local file is removed immediately.

    When using OneDrive's Files On-Demand feature, if you open a cloud-only (blue cloud icon) file, it will be downloaded and become locally available. While you're using the file, it will remain on your device.

    The file will continue to stay on your local device even after you've closed it, and its status icon will change to a green check mark in a white circle, indicating that it's available both locally and online.

    However, if you've enabled the "Storage Sense" feature on Windows 10 or later, it can automatically free up space by making older, unused files cloud-only. How long a file stays locally available before it becomes cloud-only again will depend on the settings you have configured in Storage Sense.

    To check or modify these settings, you can go to "Settings" -> "System" -> "Storage" -> "Configure Storage Sense or run it now." Here you can specify how often Storage Sense runs and when files become cloud-only, based on when they were last opened.

    So whilst this may not explain the problem you are having it does seem to fit your problem.  If your resources are in the cloud and you have downloaded them locally then they will be fine for a while as you are using them.  But then once you stop they may be considered unused, depending on your settings, and get removed.  So the next time you try to access them via your project they are no longer available and you get the error.

    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