question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Item has already been added

See original GitHub issue

Getting the following error when attempting a pull or quick-export (and probably other actions, too… dunno!).

Item has already been added. Key in dictionary: ‘TMP’ Key being added: ‘tmp’

This just started happening on a system where things had been working fine previously.

Here’s the stack trace:

git command time: [00:00:00.0020002] config --list
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'TMP'  Key being added: 'tmp'
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Collections.Hashtable.Add(Object key, Object value)
   at System.Collections.Specialized.StringDictionaryWithComparer.Add(String key, String value)
   at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
   at Sep.Git.Tfs.Core.GitRepository.SetUpPaths(ProcessStartInfo gitCommand) in D:\work\git-tfs\GitTfs\Core\GitRepository.cs:line 43
   at Sep.Git.Tfs.Core.Ext.<>c__DisplayClass1`1.<And>b__0(T x) in D:\work\git-tfs\GitTfs\Core\Ext.cs:line 22
   at Sep.Git.Tfs.Core.GitHelpers.Start(String[] command, Action`1 initialize) in D:\work\git-tfs\GitTfs\Core\GitHelpers.cs:line 223
   at Sep.Git.Tfs.Core.GitRepository.Start(String[] command, Action`1 initialize) in D:\work\git-tfs\GitTfs\Core\GitRepository.cs:line 37
   at Sep.Git.Tfs.Core.GitHelpers.<>c__DisplayClass8.<CommandOutputPipe>b__7() in D:\work\git-tfs\GitTfs\Core\GitHelpers.cs:line 57
   at Sep.Git.Tfs.Core.GitHelpers.Time(String[] command, Action action) in D:\work\git-tfs\GitTfs\Core\GitHelpers.cs:line 183
   at Sep.Git.Tfs.Core.GitHelpers.CommandOutputPipe(Action`1 handleOutput, String[] command) in D:\work\git-tfs\GitTfs\Core\GitHelpers.cs:line 54
   at Sep.Git.Tfs.Core.GitRepository.ReadTfsRemotes() in D:\work\git-tfs\GitTfs\Core\GitRepository.cs:line 93
   at Sep.Git.Tfs.Core.GitRepository.GetTfsRemotes() in D:\work\git-tfs\GitTfs\Core\GitRepository.cs:line 87
   at Sep.Git.Tfs.Core.GitRepository.ReadTfsRemote(String remoteId) in D:\work\git-tfs\GitTfs\Core\GitRepository.cs:line 57
   at Sep.Git.Tfs.Commands.Fetch.<GetRemotesToFetch>b__1(String arg) in D:\work\git-tfs\GitTfs\Commands\Fetch.cs:line 81
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at Sep.Git.Tfs.Commands.Fetch.Run(String[] args) in D:\work\git-tfs\GitTfs\Commands\Fetch.cs:line 54
   at Sep.Git.Tfs.Commands.Pull.Run(String remoteId) in D:\work\git-tfs\GitTfs\Commands\Pull.cs:line 37
   at Sep.Git.Tfs.Commands.Pull.Run() in D:\work\git-tfs\GitTfs\Commands\Pull.cs:line 32
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args) in D:\work\git-tfs\GitTfs\Util\GitTfsCommandRunner.cs:line 36
   at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs) in D:\work\git-tfs\GitTfs\GitTfs.cs:line 56
   at Sep.Git.Tfs.GitTfs.Run(IList`1 args) in D:\work\git-tfs\GitTfs\GitTfs.cs:line 39
   at Sep.Git.Tfs.Program.Main(String[] args) in D:\work\git-tfs\GitTfs\Program.cs:line 24

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
nevdelapcommented, Apr 19, 2012

A little more info to help people out…

Cygwin is setting TEMP and TMP. Windows’ own TEMP and TMP in Cygwin are temp and tmp.

TEMP=/tmp TMP=/tmp temp=‘C:\Users\nevd\AppData\Local\Temp’ tmp=‘C:\Users\nevd\AppData\Local\Temp’

The workaround I’m using is to add these lines to my .bashrc…

unset temp unset tmp

…so that in Cygwin everything always just uses Cygwin’s own TEMP and TMP.

0reactions
sc68calcommented, Mar 10, 2014

@git-tfs Do we have this in our troubleshooting guide?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I resolve "Item has already been added. Key in ...
The problem is that in a sorted list each key needs to be unique. So you need to check that you aren't inserting...
Read more >
An item with the same key has already been added Error
The error reads: "An item with the same key has already been added." It does not matter if I include the database name...
Read more >
Error "An item with the same key has already been added"
This article helps to fix the error "An item with the same key has already been added". Applies to: Windows Server 2012 R2...
Read more >
error : Item has already been added. KEy Being ...
Hello, i was trying to add a picture with name "Flow Sensor" to picturebox, and further when I tried to replace the picture...
Read more >
Error: Item has already been added. Key in dictionary
This article provides brief information on the following error: Item has already been added. Key in dictionary: 'period' Key being added: ' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found