Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 0x8007010b could display a more expressive error message - mention the actual starting directory? #9114

Closed
erichiller opened this issue Feb 11, 2021 · 9 comments · Fixed by #10045
Labels
Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@erichiller
Copy link

erichiller commented Feb 11, 2021

Environment

Windows build number:  Win32NT             10.0.19042.0 Microsoft Windows NT 10.0.19042.0
Windows Terminal version (if applicable):  Version: 1.6.10272.0

I've had this happen on the both the windows computers I use, but the above is from the machine I use most. This did use to work, and I haven't changed anything in my setup recently (besides the windows version though normal updates and terminal versions). Unknown how long this has been broken for me, but at least 1.5 weeks.

profiles in settings.json:

            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44ff}",
                "name": "Windows PowerShell 7.2-preview",
                "commandline": "pwsh.exe",
                "hidden": false,
                "background": "#000000",
                "colorScheme": "Tango Dark",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontSize": 8,
                "icon": "C:\\Program Files\\PowerShell\\7-preview\\assets\\Powershell_av_colors.ico",
                "historySize": 9999,
                "startingDirectory": "~/",
                "snapOnInput": true
            }

Steps to reproduce

Use the duplicateTab command for a hotkey.
eg.

        {
            "command": "duplicateTab",
            "keys": [
                "ctrl+up"
            ]
        },

Expected behavior

A tab to open of the same type as the current tab.

Actual behavior

I receive an error like

[error 0x8007010b when launching `pwsh.exe']

image

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 11, 2021
@zadjii-msft
Copy link
Member

I'm betting something in your prompt is emitting OSC 9;9 to "set the current directory", and we're failing to find that directory. This might be the same root cause as #8930, which was fixed by #8934. Could you do a gc function:/Prompt and share what that outputs? We might be able to find the offending quotes in that output.

We might also be able to surface this particular error better. @DHowett thoughts on having this specific error cause the connection to tell the user which directory wasn't found?

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Feb 11, 2021
@JasonWThompson
Copy link

I noticed my issue that I logged is similar to this one. Here is what I get when I run that command.

 gc function:/Prompt

        $lastCommandFailed = ($global:error.Count -gt $sl.ErrorCount) -or -not $?
        $sl.ErrorCount = $global:error.Count

        #Start the vanilla posh-git when in a vanilla window, else: go nuts
        if(Test-IsVanillaWindow) {
            Write-Host -Object ($pwd.ProviderPath) -NoNewline
            Write-VcsStatus
        }

        Reset-CursorPosition
        $prompt = (Write-Theme -lastCommandFailed $lastCommandFailed)

        if($sl.Options.ConsoleTitle) {
            $location = Get-Location
            $folder = (Get-ChildItem | Select-Object -First 1).Parent.BaseName
            $prompt += "$([char]27)]2;$($folder)$([char]7)"
            if ($location.Provider.Name -eq "FileSystem") {
                $prompt += "$([char]27)]9;9;`"$($location.Path)`"$([char]7)"
            }
        }

        $prompt

I set this custom prompt months ago from a tutorial. I'll see if I can find the tutorial and undo the change.

@DHowett
Copy link
Member

DHowett commented Feb 11, 2021

There's a build of Terminal about to come out that should fix this. Sorry for the issue! 😄

@DHowett
Copy link
Member

DHowett commented Feb 11, 2021

thoughts on having this specific error cause the connection to tell the user which directory wasn't found?

I would love to have more expressive error messages !

@zadjii-msft
Copy link
Member

I'm gonna leave this open then and re-purpose this as "we need a more expressive message in this case".

@zadjii-msft zadjii-msft changed the title Error 0x8007010b when using duplicateTab Error 0x8007010b could display a more expressive error message - mention the actual starting directory? Feb 11, 2021
@zadjii-msft zadjii-msft added Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Feb 11, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Feb 11, 2021
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Feb 11, 2021
@DHowett
Copy link
Member

DHowett commented Feb 11, 2021

As an aside,

"startingDirectory": "~/",

I'm surprised that this doesn't on its own cause trouble.

(Also, doesn't the powershell generator detect this specific instance of powershell preview?)

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Feb 12, 2021
@erichiller
Copy link
Author

Here's my output for gc function:/Prompt:

$lastCommandFailed = ($global:error.Count -gt $sl.ErrorCount) -or -not $?
$sl.ErrorCount = $global:error.Count                                                                                                                                                                                                                                                                                                                #Start the vanilla posh-git when in a vanilla window, else: go nuts
if(Test-IsVanillaWindow) {
    Write-Host -Object ($pwd.ProviderPath) -NoNewline
    Write-VcsStatus
}

Reset-CursorPosition
$prompt = (Write-Theme -lastCommandFailed $lastCommandFailed)

if($sl.Options.ConsoleTitle) {
    $location = Get-Location
    $folder = (Get-ChildItem | Select-Object -First 1).Parent.BaseName
    $prompt += "$([char]27)]2;$($folder)$([char]7)"
    if ($location.Provider.Name -eq "FileSystem") {
        $prompt += "$([char]27)]9;9;`"$($location.Path)`"$([char]7)"
    }
}

$prompt

Also, I will note that I've just updated to 1.6.10412.0 and the issue has been fixed. But I agree that a more expressive error message would be nice. Thanks for the fix!

zadjii-msft added a commit that referenced this issue May 6, 2021
This is promarily being done to unblock #9223.

Prior to this, we'd validate that the user's `startingDirectory` existed
here. If it was invalid, we'd gracefully fall back to `%USERPROFILE%`.

However, that could cause hangs when combined with WSL. When the WSL
filesystem is slow to respond, we'll end up waiting indefinitely for
their filesystem driver to respond. This can result in the whole terminal
becoming unresponsive.

Similarly, with #9223 we want users to be able to specify WSL paths in a
profile, but this bit of validation logic totally prevents that from working,
because it'll just replace the path with `%USERPROFILE%`.

If the path is eventually invalid, we'll display warning in the
`ConptyConnection`, when the process fails to launch.

Closes #9541
Closes #9114
@ghost ghost added the In-PR This issue has a related PR label May 6, 2021
@ghost ghost closed this as completed in #10045 May 12, 2021
ghost pushed a commit that referenced this issue May 12, 2021
This is primarily being done to unblock #9223.

Prior to this, we'd validate that the user's `startingDirectory` existed
here. If it was invalid, we'd gracefully fall back to `%USERPROFILE%`.

However, that could cause hangs when combined with WSL. When the WSL
filesystem is slow to respond, we'll end up waiting indefinitely for
their filesystem driver to respond. This can result in the whole terminal
becoming unresponsive.

Similarly, with #9223 we want users to be able to specify WSL paths in a
profile, but this bit of validation logic totally prevents that from working,
because it'll just replace the path with `%USERPROFILE%`.

If the path is eventually invalid, we'll display warning in the
`ConptyConnection`, when the process fails to launch.

Closes #9541
Closes #9114

![image](https://user-images.githubusercontent.com/18356694/117318675-426d2d00-ae50-11eb-9cc0-0b23c397472c.png)
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels May 12, 2021
DHowett pushed a commit that referenced this issue May 24, 2021
This is primarily being done to unblock #9223.

Prior to this, we'd validate that the user's `startingDirectory` existed
here. If it was invalid, we'd gracefully fall back to `%USERPROFILE%`.

However, that could cause hangs when combined with WSL. When the WSL
filesystem is slow to respond, we'll end up waiting indefinitely for
their filesystem driver to respond. This can result in the whole terminal
becoming unresponsive.

Similarly, with #9223 we want users to be able to specify WSL paths in a
profile, but this bit of validation logic totally prevents that from working,
because it'll just replace the path with `%USERPROFILE%`.

If the path is eventually invalid, we'll display warning in the
`ConptyConnection`, when the process fails to launch.

Closes #9541
Closes #9114

![image](https://user-images.githubusercontent.com/18356694/117318675-426d2d00-ae50-11eb-9cc0-0b23c397472c.png)

(cherry picked from commit bfc4838)
@ghost
Copy link

ghost commented May 25, 2021

🎉This issue was addressed in #10045, which has now been successfully released as Windows Terminal v1.8.1444.0.:tada:

Handy links:

@ghost
Copy link

ghost commented May 25, 2021

🎉This issue was addressed in #10045, which has now been successfully released as Windows Terminal Preview v1.9.1445.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants