The "Target word count" task unable to deal with multiple files.

This function works fine when I select only one file, but Error cames out when I select multiple files.

I think last month I have used this function for another project, and it worked just fine. What should I do?

ErrorError dialog box in Trados Studio with message: Unexpected exception when configuring file multiFileConverter for task 'Target Word Count': An item with the same key has already been added.



Generated Image Alt-Text
[edited by: Trados AI at 10:38 AM (GMT 0) on 29 Feb 2024]
emoji
  • Additon: 

    I just tried this function in another project with only one language pair, and the "Target Word Count" funciton works fine on multiple files.

    So, it doesn't work in a project with multiple language pairs? 

    emoji
  • Hi  ,

    Target Word Count plugin works fine on my Trados Studio 2022, build 17.0.6.14902 (multiple languages, multiple files).

    Which Trados Studio version are you using?

    Could you please post the full stack as shown here: https://multifarious.filkin.com/2022/12/09/community-helps-those-who-help-themselves

    Last, please have a look at the full stack and check if any of these solutions already posted in the Community applies to you:

     For My gooole API is a Error - An item with the same key has already been added- 

     An item with the same key has already been added 

     Unable to add MT Plugin - An item with the same key has already been added 

     ERROR > An item with the same key has already been added 

    emoji
  • Hi  ,

    Thanks for the reply, here is a xml from one of 25 errors. 

    <SDLErrorDetails time="2023/03/23 18:01:59">
      <ErrorMessage>Unexpected exception when configuring file multiFileConverter for task 'Target Word Count': An item with the same key has already been added..</ErrorMessage>
      <Exception>
        <Type>Sdl.ProjectApi.ProjectApiException, Sdl.ProjectApi, Version=17.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.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
          <ParamName />
          <HelpLink />
          <Source>mscorlib</Source>
          <HResult>-2147024809</HResult>
          <StackTrace><![CDATA[   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at Sdl.ProjectAutomation.AutomaticTasks.ExecutingAutomaticTask.GetWordCounter(ProjectFile executingTaskFile)
       at Sdl.ProjectAutomation.AutomaticTasks.AbstractFileContentProcessingAutomaticTask.GetWordCounter(ProjectFile projectFile)
       at Sdl.Community.TargetWordCount.WordCountBatchTask.ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
       at Sdl.ProjectApi.Implementation.TaskExecution.ContentProcessingTaskImplementationAdapter.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>Studio17</ProductVersion>
        <EntryAssemblyFileVersion>17.0.5.14757</EntryAssemblyFileVersion>
        <OperatingSystem>Microsoft Windows 11 Home</OperatingSystem>
        <ServicePack>NULL</ServicePack>
        <OperatingSystemLanguage>1041</OperatingSystemLanguage>
        <CodePage>932</CodePage>
        <LoggedOnUser>DESKTOP-9M8MFGA\zhu</LoggedOnUser>
        <DotNetFrameWork>4.0.30319.42000</DotNetFrameWork>
        <ComputerName>DESKTOP-9M8MFGA</ComputerName>
        <ConnectedToNetwork>True</ConnectedToNetwork>
        <PhysicalMemory>8170024 MB</PhysicalMemory>
      </Environment>
    </SDLErrorDetails>

    oh... I haven't used the code function on this website, pls let me know if I am doing it right. 

    emoji
  •  

    The specific error message "An item with the same key has already been added." normally occurs when multiple versions of the plugin have been installed.  Perhaps try removing the plugin from these locations, reinstall from the appstore making sure you have the latest one and try again:

    %APPDATA%\Trados\Trados Studio\17\Plugins\Packages
    %APPDATA%\Trados\Trados Studio\17\Plugins\Unpacked

    %LOCALAPPDATA%\Trados\Trados Studio\17\Plugins\Packages
    %LOCALAPPDATA%\Trados\Trados Studio\17\Plugins\Unpacked

    c:\ProgramData\Trados\Trados Studio\17\Plugins\Packages
    c:\ProgramData\Trados\Trados Studio\17\Plugins\Unpacked

    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  

    I did what you posted, and... it still doesn't work.:(

    It's alright though, I created a package for review, and send it to my friend, let her did the Target Word Count. She uses Studio 2021, and the plugin works fine in the project of multiple language pairs. (Or maybe it works fine because I only include one language pair in the package? IDK.) Like I mentioned before, this plugin works fine on single language pair project in Studio 2022. Have no idea what's going on...

    Anyway, thank you! 

    emoji
  •   

    Thank you.  I installed and test this plugin this morning.  I also don't get any errors running it on projects with multiple language pairs.

     Screenshot of the view in the "Reports Viewer Plus" app showing the target word count report for multiple languages in a multilingual project.

    If you want to I'd be happy to look at your specific project?  Can you share it with me?

    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
  • Dear  ,

    I'm sorry I just seen your reply! have been busy lask week. And sorry I can't share that specific project to you because the NDA. Instead, I can share some more detail of this problem in description.  

    This particular project is created in two langauge pairs. A: Japanese-English. B: Japanese-Chinese.

    The source files are idml files, and we have Translation memory & Termbase for both langauge pairs. I have tried Target Word Count for multiple files in language pair B, and it works just fine. It seems like the problem only appears in Language pair A. 

    One more thing is that I have edit the source & target segement of A in Studio editor view, may that's the reason caused error. 

    I hope these infos helps. Thank you a loooooot!

    emoji