Display a specific error for not finding the default profile #1785

Closed
opened 2026-01-30 22:36:25 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Jun 20, 2019).

Originally assigned to: @zadjii-msft on GitHub.

From #1343

Even more correct would be to specifically display a message that there was no default profile (though that might be too much for this release).

  • If we load the profiles.json and the defaultProfile doesn't exist in the list of profiles, we should display an error specific to that failure case.
  • We should also use the first profile as the default temporarily. We'll need to make sure not to persist this runtime change.

Maybe also:

  • Check if the commandline is a path to a single executable, and if it is, warn if it doesn't exist? Dunno how we'd get the first arg from the commandline easily but it could totally be done.
Originally created by @zadjii-msft on GitHub (Jun 20, 2019). Originally assigned to: @zadjii-msft on GitHub. From #1343 > Even more correct would be to specifically display a message that there was no default profile (though that might be too much for this release). * [ ] If we load the `profiles.json` and the `defaultProfile` doesn't exist in the list of profiles, we should display an error specific to that failure case. * [ ] We should also use the _first_ profile as the default _temporarily_. We'll need to make sure not to persist this runtime change. Maybe also: * [ ] Check if the commandline is a path to a single executable, and if it is, warn if it doesn't exist? Dunno how we'd get the first arg from the commandline _easily_ but it could totally be done.
Author
Owner

@karypid commented on GitHub (Jul 2, 2019):

I would like to add that this should also happen if the default profile is present but fails to load.

So, even if profiles.json is correct and default profile actually exists in it, but the command runs and exits in less than 5 seconds, you should get a dialog saying "command exited almost immediately, please check profiles.json to ensure it is correct".

This is similar to what OS X's Terminal application and the popular Windows "ConEmu" application already do.

I actually came across this issue in a nasty way: when I installed Windows Terminal on a new laptop, Windows Store downloaded the profiles.json file from my previous laptop. When I launched the application the window appeared and immediately disappeared without giving me a chance to read the output. What was happening is that I had edited the command for my default profile and set it to:

            "commandline" : "powershell.exe -noexit -file env.ps1",

Now, normally in my home folder I have a file "env.ps1" where I define some functions, aliases etc. Because the new laptop did NOT have this file yet, powershell would exit immediately with an error.

@karypid commented on GitHub (Jul 2, 2019): I would like to add that this should also happen if the default profile is present but fails to load. So, even if profiles.json is correct and default profile actually exists in it, but the command runs and exits in less than 5 seconds, you should get a dialog saying "command exited almost immediately, please check profiles.json to ensure it is correct". This is similar to what OS X's Terminal application and the popular Windows "ConEmu" application already do. I actually came across this issue in a nasty way: when I installed Windows Terminal on a new laptop, Windows Store downloaded the profiles.json file from my previous laptop. When I launched the application the window appeared and immediately disappeared without giving me a chance to read the output. What was happening is that I had edited the command for my default profile and set it to: ``` "commandline" : "powershell.exe -noexit -file env.ps1", ``` Now, normally in my home folder I have a file "env.ps1" where I define some functions, aliases etc. Because the new laptop did NOT have this file yet, powershell would exit immediately with an error.
Author
Owner

@miniksa commented on GitHub (Aug 1, 2019):

Please at least minimally stop the crash from happening when the default is gone. Choose a different profile and try to recover.

@miniksa commented on GitHub (Aug 1, 2019): Please at least minimally stop the crash from happening when the default is gone. Choose a different profile and try to recover.
Author
Owner

@ghost commented on GitHub (Aug 27, 2019):

:tada:This issue was addressed in #2422, which has now been successfully released as Windows Terminal Preview v0.4.2382.0.🎉

Handy links:

@ghost commented on GitHub (Aug 27, 2019): :tada:This issue was addressed in #2422, which has now been successfully released as `Windows Terminal Preview v0.4.2382.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.4.2382.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1785