Found multiple profiles with the same GUID in your settings file #15870

Open
opened 2026-01-31 04:50:58 +00:00 by claunia · 6 comments
Owner

Originally created by @sdwheeler on GitHub (Nov 12, 2021).

Windows Terminal version (or Windows build number)

Windows Terminal Version: 1.11.2921.0

Other Software

PowerShell (multiple versions)

Steps to reproduce

I have multiple versions of PowerShell installed because I need to support all versions. I do not have WSL installed.

  1. I deleted all of my PowerShell profiles and uninstalled PowerShell. My setttings.json file only contained CMD and Windows PowerShell 5.1. In that state, I did not get the error
  2. I installed PowerShell 7.2 via the MSI package and installed PS 7.0.8 and 7.1.5 from zip files.
  3. Launched Windows Terminal. It added profiles 7.1.5 and 7.0.8. It made 7.1.5 the default profile. It didn't add 7.2, which should have been the default. It is the version that is actually registered on the system (via MSI install). In this state, the error occurs.

I have edited the json file to ensure there are not duplicates. See my settings file attached to this issue
LocalSettings-State.zip
.

Expected Behavior

No response

Actual Behavior

image

Originally created by @sdwheeler on GitHub (Nov 12, 2021). ### Windows Terminal version (or Windows build number) Windows Terminal Version: 1.11.2921.0 ### Other Software PowerShell (multiple versions) ### Steps to reproduce I have multiple versions of PowerShell installed because I need to support all versions. I do not have WSL installed. 1. I deleted all of my PowerShell profiles and uninstalled PowerShell. My setttings.json file only contained CMD and Windows PowerShell 5.1. In that state, I did not get the error 2. I installed PowerShell 7.2 via the MSI package and installed PS 7.0.8 and 7.1.5 from zip files. 3. Launched Windows Terminal. It added profiles 7.1.5 and 7.0.8. It made 7.1.5 the default profile. It didn't add 7.2, which should have been the default. It is the version that is actually registered on the system (via MSI install). In this state, the error occurs. I have edited the json file to ensure there are not duplicates. See my settings file attached to this issue [LocalSettings-State.zip](https://github.com/microsoft/terminal/files/7530091/LocalSettings-State.zip) . ### Expected Behavior _No response_ ### Actual Behavior ![image](https://user-images.githubusercontent.com/19415881/141527023-062b0731-f50a-426b-bf0e-29ff14ca64dd.png)
claunia added the Area-SettingsIssue-BugProduct-TerminalPriority-2 labels 2026-01-31 04:50:58 +00:00
Author
Owner

@DHowett commented on GitHub (Nov 12, 2021):

Wow, that's totally not expected.

Can you list the install locations for all your PowerShell instances? There's likely an issue in the PowerShell profile generator.

@DHowett commented on GitHub (Nov 12, 2021): Wow, that's totally not expected. Can you list the install locations for all your PowerShell instances? There's likely an issue in the PowerShell profile generator.
Author
Owner

@sdwheeler commented on GitHub (Nov 12, 2021):

@DHowett All the install locations are listed in the attached settings file.

@sdwheeler commented on GitHub (Nov 12, 2021): @DHowett All the install locations are listed in the attached settings file.
Author
Owner

@sdwheeler commented on GitHub (Nov 12, 2021):

Besides the built-in Windows PowerShell 5.1 I have the following instances:

[git]:❭ dir 'C:\Program Files\PowerShell\'

    Directory: C:\Program Files\PowerShell

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          11/12/2021 12:16 PM                7
d----          11/12/2021 12:19 PM                7.0.8
d----          11/12/2021 12:24 PM                7.1.5
d----           3/26/2021  9:13 AM                Modules
d----           1/10/2018  7:12 PM                Scripts

There is no MS Store version installed and no preview version installed.

@sdwheeler commented on GitHub (Nov 12, 2021): Besides the built-in Windows PowerShell 5.1 I have the following instances: ``` [git]:❭ dir 'C:\Program Files\PowerShell\' Directory: C:\Program Files\PowerShell Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 11/12/2021 12:16 PM 7 d---- 11/12/2021 12:19 PM 7.0.8 d---- 11/12/2021 12:24 PM 7.1.5 d---- 3/26/2021 9:13 AM Modules d---- 1/10/2018 7:12 PM Scripts ``` There is no MS Store version installed and no preview version installed.
Author
Owner

@elsaco commented on GitHub (Nov 12, 2021):

@sdwheeler looking at your settings there are seven profiles in state.json and six only in settings.json:

{
	"generatedProfiles" : 
	[
		"{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", <-- pwsh 5.1
		"{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", <-- cmd
		"{574e775e-4f2a-5b96-ac1e-a2962a402336}",  
		"{5fb123f1-af88-5b5c-8953-d14a8def1978}", <-- pwsh 7.1.5
		"{b453ae62-4e3d-5e58-b989-0a998ec441b8}", <-- Azure
		"{a3a2e83a-884a-5379-baa8-16f193a13b21}", <-- pwsh 7.2.0
		"{8cf95b28-31d3-463f-b3a5-4066d002b970}"  <-- pwsh 7.0.8
	]
}

Didn't find a match for guid starting with 574e. On my system that starts pwsh-7.2:

            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },

Does it help if you remove it from state.json. Or just delete the entire state.json file and restart WT. It will be recreated.

@elsaco commented on GitHub (Nov 12, 2021): @sdwheeler looking at your settings there are seven profiles in `state.json` and six only in `settings.json`: ``` { "generatedProfiles" : [ "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", <-- pwsh 5.1 "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", <-- cmd "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "{5fb123f1-af88-5b5c-8953-d14a8def1978}", <-- pwsh 7.1.5 "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", <-- Azure "{a3a2e83a-884a-5379-baa8-16f193a13b21}", <-- pwsh 7.2.0 "{8cf95b28-31d3-463f-b3a5-4066d002b970}" <-- pwsh 7.0.8 ] } ``` Didn't find a match for guid starting with 574e. On my system that starts pwsh-7.2: ``` { "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "PowerShell", "source": "Windows.Terminal.PowershellCore" }, ``` Does it help if you remove it from `state.json`. Or just delete the entire `state.json` file and restart WT. It will be recreated.
Author
Owner

@sdwheeler commented on GitHub (Nov 12, 2021):

I tried both. First I removed the one entry from state.json. Error persists.

Then I deleted the state.json file. I exited and restarted Windows Terminal. The error persists. The new state.json contains the same guids.

@sdwheeler commented on GitHub (Nov 12, 2021): I tried both. First I removed the one entry from state.json. Error persists. Then I deleted the state.json file. I exited and restarted Windows Terminal. The error persists. The new state.json contains the same guids.
Author
Owner

@DHowett commented on GitHub (Nov 12, 2021):

Alright, this is definitely a failure on our part. For now, you may want to set (globally):

"disabledProfileSources": [ "Windows.Terminal.PowershellCore" ]

and manage your PowerShell profiles yourself (as you're already doing!)

Right now, Terminal's PowerShell scanner only uniques PS instances by major version. What we end up finding is:

MajorVersion  Flags        Path
------------  -----------  ----
           7  Traditional  C:\Program Files\PowerShell\7
           7  Traditional  C:\Program Files\PowerShell\7.0.8
           7  Traditional  C:\Program Files\PowerShell\7.1.5

Those are then named based on the information we extract from them:

PowerShell 7
PowerShell 7
PowerShell 7

They then receive GUIDs based on their names:

PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978}
PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978}
PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978}

Those instances are then sorted, and one of them is elected to be the "best" PowerShell. This one is assigned the "default modern PowerShell" GUID and name:

PowerShell - {574e775e-4f2a-5b96-ac1e-a2962a402336}
PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978}
PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978}

The bottom two, of course, are the same shape in Terminal's eyes.

Even though you've deleted them all, Terminal still runs detection.

There are two bugs here:

  1. We don't care about minor version. The detector was written for "standard layout" PowerShell installs with only a major version number in the folder.
  2. We run duplicate GUID detection without checking whether the profile has been deleted.
@DHowett commented on GitHub (Nov 12, 2021): Alright, this is definitely a failure on our part. For now, you may want to set (globally): ```json "disabledProfileSources": [ "Windows.Terminal.PowershellCore" ] ``` and manage your PowerShell profiles yourself (as you're already doing!) Right now, Terminal's PowerShell scanner only uniques PS instances by _major version_. What we end up finding is: ``` MajorVersion Flags Path ------------ ----------- ---- 7 Traditional C:\Program Files\PowerShell\7 7 Traditional C:\Program Files\PowerShell\7.0.8 7 Traditional C:\Program Files\PowerShell\7.1.5 ``` Those are then named based on the information we extract from them: ``` PowerShell 7 PowerShell 7 PowerShell 7 ``` They then receive GUIDs **based on their names**: ``` PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978} PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978} PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978} ``` Those instances are then sorted, and one of them is elected to be the "best" PowerShell. This one is assigned the "default modern PowerShell" GUID and name: ``` PowerShell - {574e775e-4f2a-5b96-ac1e-a2962a402336} PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978} PowerShell 7 - {5fb123f1-af88-5b5c-8953-d14a8def1978} ``` The bottom two, of course, are the same shape in Terminal's eyes. Even though you've deleted them all, Terminal still runs detection. There are two bugs here: 1. We don't care about minor version. The detector was written for "standard layout" PowerShell installs with only a major version number in the folder. 2. We run duplicate GUID detection without checking whether the profile has been deleted.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15870