The item $/... already exists.

Nov 27, 2012 at 3:25 PM
Edited Nov 27, 2012 at 3:38 PM

I got this error a few times now. It happens when I do git tf checkin (depth set to 2147483647).

Unfortunately I cannot find the exact steps to reproduce, but this thing shows up after I upgrade packages.
In my case:
* pull latest changes from tfs
* do some work on a local machine (upgrade packages)
* rebase/squash some commits
* git tf checkin

The mentioned path does not exist on the server. In order to get past this error I had to revert back to previous (nuget) package versions, checkin, update packages and check in again.

Can anyone shed some light on this?

Developer
Nov 28, 2012 at 2:01 PM

Can you please share any errors in the git-tf logs found here "%LOCALAPPDATA%\Microsoft\Team Foundation\4.0\Logs"

Nov 30, 2012 at 2:19 PM

Sure. Here you go:

2012-11-30 16:17:55,932 ERROR [main] (git-tf) Error executing task CheckinHeadCommitTask
java.lang.Exception: failed to pend changes to TFS due to the following errors. Please fix the errors and retry check in.
The item $/<project pathhere>/packages/DotNetOpenAuth.AspNet.4.1.4.12333 already exists.
The item $/<project pathhere>/packages/DotNetOpenAuth.Core.4.1.4.12333 already exists.
The item $/<project path here>/packages/DotNetOpenAuth.OpenId.Core.4.1.4.12333 already exists.
    at com.microsoft.gittf.core.util.WorkspaceOperationErrorListener.validate(WorkspaceOperationErrorListener.java:109)
    at com.microsoft.gittf.core.tasks.pendDiff.PendDifferenceTask.pendBatchRenames(PendDifferenceTask.java:879)
    at com.microsoft.gittf.core.tasks.pendDiff.PendDifferenceTask.pendRenames(PendDifferenceTask.java:797)
    at com.microsoft.gittf.core.tasks.pendDiff.PendDifferenceTask.pendChanges(PendDifferenceTask.java:584)
    at com.microsoft.gittf.core.tasks.pendDiff.PendDifferenceTask.run(PendDifferenceTask.java:259)
    at com.microsoft.gittf.core.tasks.framework.TaskExecutor.execute(TaskExecutor.java:145)
    at com.microsoft.gittf.core.tasks.CheckinHeadCommitTask.run(CheckinHeadCommitTask.java:450)
    at com.microsoft.gittf.core.tasks.framework.TaskExecutor.execute(TaskExecutor.java:145)
    at com.microsoft.gittf.client.clc.commands.CheckinCommand.run(CheckinCommand.java:215)
    at com.microsoft.gittf.client.clc.Main.main(Main.java:328)

Developer
Nov 30, 2012 at 2:25 PM

This looks like a bug to me in the rename logic we have in git-tf. Can you try checking in using this command

git tf checkin --renamemode=justFiles

and let me know if that does not work ?

Nov 30, 2012 at 2:47 PM

Sure. I'll keep you posted.
Thanks for the quick response ;)

Nov 30, 2012 at 2:58 PM

using --renamemode=justFIles worked.

Developer
Nov 30, 2012 at 3:01 PM

The problem was probably that you were checking in a complex (or maybe simple) case of multiple file / folder renames. We have some heuristics to calculate the folder renames that has happened (since git does not track folder renames) but this heuristic probably has a bug that I will try to repro and fix.

Thanks,

Youhana

Nov 30, 2012 at 3:18 PM

Well, sounds just about right. The operation that caused this was 'just' a nuget package update. So the simplest way to reproduce this would be:

  • create a new project (in my case mvc basic template - it includes some packages that are out of date)
  • git commit, git tf checkin
  • update-package
  • git commit, git tf checkin

I haven't verified that this will actually cause the error, but that's pretty much the workflow. When a package is update it changes the dir name just 'slightly' so from what you wrote, git is likely to treat this as a rename.

Hope this helps and thanks again for the tip.

Dec 6, 2012 at 9:05 PM

Hi there,

I had the same problem after a major refactoring session - "git tf checkin --renamemode=justFiles" did the trick

thanks

Toby