"Element with id already registered" error when Search & Compare view opens to show a comparison
Description
To repro, use a command like "compare to/with ..." on a commit/branch on the graph or branches view while the Search & Compare view is closed/minimized/hidden.
It will open the comparison but then immediately it will vanish, with the error "element with id already registered". Refreshing the Search & compare view fixes the issue and the comparison shows correctly.
GitLens Version
2024.8.205 (pre-release)
VS Code Version
No response
Git Version
No response
Logs, Screenshots, Screen Captures, etc
No response
Me too - also, I believe the behaviour has changed. Currently if I right-click a commit and choose 'Select for compare' it immediately switches to GitLens Search and Compare - even though only one party for the comparison has been chosen - is this related?
@easyTree Shouldn't be related, but definitely an issue. I've opened https://github.com/gitkraken/vscode-gitlens/issues/3448 to track it
Tried to reproduce. For me it's reproduced only twice and then I can not reproduce it again, it's strange
Have the same issue for a year now. At first I thought that it's my local installation was corrupted, but then I've faced with the same problem on my colleague's installation too. Both are on Linux so, maybe it's OS-related.
Every time I'm trying to perform a Search with GitLens Search&Compare widget at first results are shown, then the error appears and Search results is collapsed in the list. When you're trying to expand search result - the same error appears.
However, if you will perform another search using + button at the top of the widget - it will allow you to expand new search results just fine, so I'm using it as a workaround for now :)
If you need any details, I will help to provide it.
My current versions info: Arch Linux asus 6.9.3-arch1-1 SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:45 +0000 x86_64 GNU/Linux VS-Code OSS 1.90.0 Electron 29.4.3
It also happens for me, when i try to expand a branch from my branches view it starts loading for a bit then i am prompted with an error
Element with id gitlens://viewnode/compare-branch/repo/bla bla bla is already registered.
It's extremely annoying and it happens arbitrary.
The "fix" for it is to manually fetch from origin
I can reproduce this consistently if I search for commits by message. It works the first time, but future searches fail. It is a very annoying bug since this is the primary feature I use GitLens for. I'm on Windows so this is not Linux specific. The only unusual feature that I'm aware that I'm using is worktrees.
I had the issue with Search and Compare but it has worked for me in a while now. However, most of my colleagues have this issue and can reproduce it consistently if needed.
When I start a new search it works fine. When I update the search, I get the error "Element with id gitlens://viewnode/search/change:... is already registered". Clearing the search and starting a new search works again fine. I was doing this yesterday many times using vscode insider and GitLens release and never experienced an issue, but this started today.
I'm experiencing this with vscode 1.96.2 and the latest 1.97.0-insider. I had it with GitLens 16.1.1, so switched to 2025.1.904, but still see it.
Version: 1.97.0-insider (system setup)
Commit: 2569d71b0491afddb23e173ee6cc2eb284f1b0b9
Date: 2025-01-08T13:30:54.238Z
Electron: 32.2.7
ElectronBuildId: 10660205
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631
Version: 1.96.2 (system setup)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631
Fixed by 3115830862acc933f2b1f927b8859b472304a6a8 and 7b29beffa6f07ed6b6b69487cc01113aef4682ea
Can you please verify this fix in tomorrow's (v2025.6.01xx) pre-release edition of GitLens? Thank you so much!
You can switch to the pre-release edition of GitLens, by clicking on the "Switch to Pre-Release version of this extension" from the Extensions view.

Verified in today's pre-release.
Issue still occurring on pre-release as of today. MacOS, gitlens 17.3.1
@jhartman86 can you provide more details on when/where you see this? And is it reproducible?
@eamodio it is reproducible, and I believe it's caused by having a workspace configured with multiple repos in it (each subdirectory of the workspace is itself a git repo... I'm guessing that's relevant).
Easiest way to get it to trigger is opening Gitlens Inspect > Compare References, and picking two SHAs to compare. It happens every time. That said, it had worked fine for a long time until recently.
If there's a way to pull a debug log or anything that'd be helpful just lmk and I'll post it back here.
Thanks!
Still occurring with me too.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.