SDL WorldServer Save or Export error 'Container not found' and other errors related to 'Collection'

Symptoms/context:

One of the following errors occur when saving or exporting a task to a WSXZ Studio package:

Attempting to insert an item that is already part of a collection.
MarkupDataContainer_AlreadyInCollectionError
Container not found for....
The given Key was not present in the dictionary


These errors will also be visible when exporting a Task that has not been yet fixed. Mostly, this happens with source files in DOCX format.

If the export includes multiple Tasks, the error will be visible in the Export summary, but the translator might overlook it or ignore it because the other tasks have been exported. The problematic task will then appear with 0 KB file size in the package and will prevent the package to be opened with the error Root element is missing. See also

WorldServer Studio package cannot be opened because one the sdlxliff files is empty and has 0 KB file size - 'Root element is missing' error
 
Root Cause:
 
This issue happens because of defects WS-5721 and WS-5783 with the Microsoft Word 2007-2013 File Type, fixed in WorldServer starting from Version 10.4.5. when using the Microsoft Word 2007-2016 Studio File Type
 
Resolution:
The errors MarkupDataContainer_AlreadyInCollectionError  and Container not found for.... are fixed in WorldServer 10.4.5. in the Microsoft Word 2007-2016 Studio File Type. If you encounter this error in WorldServer 10.4.5. or later version, make sure you are using the correct filter to segment your DOCX files

For earlier versions and the other type of errors mentioned in this article, follow these steps:

1- Open the affected Task in Browser Workbench 
2- Find segments with many placeholders and click on the placeholder icon to check if the placeholder numbers in the source segment match the ones in the target segment. 
3- You will find some occurrences where there is one or more placeholders displayed in the placeholder pop-up window than in the target segment.
4- Copy the content of the target segment to a file
5- Delete the content of the target segment. If there are multiple segments affected, repeat these steps to fix all occurrences. If you work in a live-TM mode WorldServer system and the target segment was not translated, make sure you set the status to None, if it was translated, it is ok to set it to Pending Review. Note: the segment status is not relevant if you work in a NON live-tm mode system since you can save your changes wthout updating the TM.
6- Do a Save and confirm it can be done without issues.
7- Copy back the content into the target segment(s) and do another Save. It should work without errors.
9- If the Task is in Autoerror, complete the Autoerror.
10-  Remove the TM entries resulting from your Save action (Step 5-6) where the content of the target segment was removed. . If it is not in live-tm modus, only clicking on Save and Update TM in Browser Workbench would have updated the TM. If you clicked on Save only, in a non- live tm modus the TM did not get updated, hence, no further action is needed.


NOTE: this step #10 is only necessary if your WorldServer environment is in Live-TM mode. If you are not sure if your environment is in live TM mode, please refer to this article: 

As a WorldServer User, how do I know if my WorldServer is a live-tm or a non live-tm environment?.

 
Reference