"An item with the same key has already been added" at open repository

dbalashov's Avatar


28 Apr, 2013 02:50 PM

I created a repository and copied an existing repository ( with multiple commits ) in this new repository. Then, when you open the page I get an error repository:

[ArgumentException: An item with the same key has already been added.] System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52 System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) +10691810 System.Collections.Generic.Dictionary2.System.Collections.Generic.ICollection>.Add(KeyValuePair2 keyValuePair) +37 HgSharp.Core.Util.CollectionExtensions.AddRange(ICollection1 collection, IEnumerable1 items) in d:\Projects\hglab\lib\hgsharp\src\HgSharp.Core\Util\CollectionExtensions.cs:21 HgSharp.Core.HgManifestEntry..ctor(HgRevlogEntryMetadata metadata, IList1 files) in d:\Projects\hglab\lib\hgsharp\src\HgSharp.Core\HgManifestEntry.cs:37 HgSharp.Core.HgManifestReader.ReadManifestEntry(HgRevlogEntryData revlogEntryData) in d:\Projects\hglab\lib\hgsharp\src\HgSharp.Core\HgManifestReader.cs:53 HgSharp.Core.HgManifest.get_Item(HgNodeID hgNodeID) in d:\Projects\hglab\lib\hgsharp\src\HgSharp.Core\HgManifest.cs:23 HgLab.Areas.Project.Controllers.RepositoryController.Files(Repository repository, String changeset, String path) in d:\Projects\hglab\src\HgLab\Areas\Project\Controllers\RepositoryController.cs:78 lambda_method(Closure , ControllerBase , Object[] ) +193 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +210 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.b__12() +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +256 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +22 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +190 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324 System.Web.Mvc.Controller.ExecuteCore() +105 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +88 HgLab.Core.Framework.Web.HgLabControllerBase.Execute(RequestContext requestContext) in d:\Projects\hglab\src\HgLab.Core\Framework\Web\HgLabControllerBase.cs:67 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19 System.Web.Mvc.Async.<>c__DisplayClass81.b__7(IAsyncResult ) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.<>c_DisplayClasse.b__d() +49 System.Web.Mvc.SecurityUtil.b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9

  1. Support Staff 1 Posted by Anton Gogolev on 29 Apr, 2013 03:40 PM

    Anton Gogolev's Avatar


    Is there any chance this particular repository contains files that differ
    only in casing, like Foo.txt and foo.txt?

  2. 2 Posted by dbalashov on 29 Apr, 2013 03:43 PM

    dbalashov's Avatar

    No, repository copied from Windows station (from my work machine). as you know, NTFS can't contain multiple files with same names. I will try to use debugger for solving this :)

  3. Support Staff 3 Posted by Anton Gogolev on 29 Apr, 2013 03:49 PM

    Anton Gogolev's Avatar

    That's strange.

    Could you please help me out here? Here's what you need to do:

    • In your terminal (cmd.exe), cd to <your-project-directory>\.hg\store
    • Run hg debugindex 00manifest.i and note the leftmost number in the last row of output
    • Next, run hg debugdata 00manifest.d {that-noted-number} > manifest.txt (or, if it fails, run hg debugdata 00manifest.i {that-noted-number} > manifest.txt) and attach the manifest.txt here.

    Thanks in advance!

  4. 4 Posted by dbalashov on 11 May, 2013 07:20 PM

    dbalashov's Avatar

    Any games with different our repositories does not result in errors. Only one repository raise error while page opening. See attached files with command results.

  5. Support Staff 5 Posted by Anton Gogolev on 12 May, 2013 12:10 PM

    Anton Gogolev's Avatar


    Just to confirm my thoughts: what is the Encoding that HgLab is configured to use? It's set in Administration - Repositories.

    I assume it's currently set to "65001 - Unicode (UTF8)". If so, changing it to "1251 - Cyrillic" should fix this particular problem, but may come bite you later with some other non-Cyrillic repository. Unfortunately, Mercurial and UTF8 and Windows do not play together nicely.

  6. 6 Posted by dbalashov on 12 May, 2013 12:39 PM

    dbalashov's Avatar

    Yep. It's solve problem. Thanks!

  7. dbalashov closed this discussion on 12 May, 2013 12:39 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

03 Aug, 2022 01:49 PM
05 Jul, 2022 07:01 PM
28 Mar, 2022 04:42 PM
21 Jan, 2022 10:43 AM
20 Jan, 2022 10:45 AM


18 Jan, 2022 10:15 AM
19 Mar, 2021 06:13 PM
01 Mar, 2021 02:51 PM
01 Jan, 2021 02:19 AM
28 Aug, 2020 08:34 AM
23 Jun, 2020 08:29 AM