Error Occurred in 'Create Map' An item with the same key has already been added.

Issue

An error occurred while attempting to add a new Map


The error message is displayed as shown below:

Error Occurred in 'Create Map'

Message: An item with the same key has already been added.

Possible Cause

The problem could arise if a Microsoft Custom Style is added with a name that already exists. It's important to ensure that each Microsoft Style has a unique name to avoid conflicts.

Solution

To resolve this issue, follow these steps

Step Action
1 In your Word document, go to the "Home" tab.
2

Click on the small arrow at the bottom right corner of the "Styles" group. This opens the Styles pane.

3

Press the button "Options..."

4

Select styles to show 'All styles'

5 Press "OK"
6

Search any Duplicate Style, and right mouse click on it.

7

Press "Modify..."

8

Give it a unique name:

Important Note: This must be an unused name. If you give it the name of an existing item, Microsoft Word will crash.

9

Press "OK"

10

You should now be able to insert a Map without any Error.

Optional technical side note information

For those delving into the log files found at:
C:\Users\[USERNAME]\AppData\Local\Information Mapping\FS Pro 6\Log\logging.log

You will notice an indication of the duplicated name issue.

Specifically, an error message stating "ERROR Key already exists: Unresolved Mention6" is visible.

 

Below the complete log details: 

2024-01-30 10:30:13,811 [VSTA_Main] ERROR Key already exists: Unresolved Mention6
2024-01-30 10:30:13,816 [VSTA_Main] ERROR Create Map
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at InformationMapping.FSPro.PureOpenXmlHelper.CreateStyleMap(IEnumerable`1 styles, Boolean inverted)
at InformationMapping.FSPro.PureOpenXmlHelper.CreateInvertedStyleMap(Styles styles)
at InformationMapping.FSPro.Domain.OpenXmlElementController..ctor(String originalOxml, FontSet fontSet, UInt32 blockTableWidth, Boolean isNewElement)
at InformationMapping.FSPro.Word.Elements.OpenXmlMapController..ctor(String originalOxml, FontSet fontSet, Map info, UInt32 blockTableWidth, Boolean isNewElement)
at InformationMapping.FSPro.Word.Elements.Map.CreateViaOxml(Map info, IEnumerable`1 copyFrom, InfoType infoType)
at InformationMapping.FSPro.Word.Elements.Map.CreateNewFromPath(Map info, IEnumerable`1 copyFromPathName, InfoType infoType)
at InformationMapping.FSPro.Word.Elements.Map.CreateNewSet(Map info, IEnumerable`1 copyFrom, InfoType infoType)
at InformationMapping.FSPro.Word.Elements.Map.CreateNew(Map info, ReusableItem copyFrom, InfoType infoType)
at InformationMapping.FSPro.Word.RibbonHandler.<>c.<BtnMap_Click>b__68_0()
at InformationMapping.FSPro.Word.ExecutionGuard.ExecuteGuardedAction(String actionName, GuardedAction action, AttachDocument attachDocument, Boolean allowUndo, Boolean showProgress, Boolean rebuildOutline)
2024-01-30 10:30:13,830 [VSTA_Main] INFO
Exception Extra Fields: ParamName: ; HResult: -2147024809
Have more questions? Submit a request

Comments