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

    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
Children