oh-my-posh: `pwsh` - Prompt Doesn't Render When `$PWD` is a UNC Path

Code of Conduct

  • I agree to follow this project’s Code of Conduct

What happened?

Prompt doesn’t render and appears as PS> when current working directly is a UNC path ( e.g \\localhost\c$ ).

Repro

oh-my-posh.exe init pwsh --config $OhMyPoshConfig | Invoke-Expression
cd \\localhost\c$

I am using Version 7.59.4.

Theme

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#c386f1",
          "foreground": "#ffffff",
          "leading_diamond": "\ue0b6",
          "style": "diamond",
          "template": " {{ .UserName }} ",
          "trailing_diamond": "\ue0b0",
          "type": "session"
        },
        {
          "background": "#ff479c",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "folder_separator_icon": " \ue0b1 ",
            "home_icon": "~",
            "style": "folder"
          },
          "style": "powerline",
          "template": " \uf74a  {{ .Path }} ",
          "type": "path"
        },
        {
          "background": "#fffb38",
          "background_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}",
            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}",
            "{{ if gt .Ahead 0 }}#B388FF{{ end }}",
            "{{ if gt .Behind 0 }}#B388FF{{ end }}"
          ],
          "foreground": "#193549",
          "leading_diamond": "\ue0b6",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "branch_max_length": 25,
            "fetch_stash_count": true,
            "fetch_status": true,
            "fetch_upstream_icon": true
          },
          "style": "powerline",
          "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} ",
          "trailing_diamond": "\ue0b4",
          "type": "git"
        },
        {
          "background": "#6CA35E",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "fetch_version": true
          },
          "style": "powerline",
          "template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
          "type": "node"
        },
        {
          "background": "#8ED1F7",
          "foreground": "#111111",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "fetch_version": true
          },
          "style": "powerline",
          "template": " \ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
          "type": "go"
        },
        {
          "background": "#4063D8",
          "foreground": "#111111",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "fetch_version": true
          },
          "style": "powerline",
          "template": " \ue624 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
          "type": "julia"
        },
        {
          "background": "#FFDE57",
          "foreground": "#111111",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "display_mode": "files",
            "fetch_virtual_env": false
          },
          "style": "powerline",
          "template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
          "type": "python"
        },
        {
          "background": "#AE1401",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "display_mode": "files",
            "fetch_version": true
          },
          "style": "powerline",
          "template": " \ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
          "type": "ruby"
        },
        {
          "background": "#FEAC19",
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "display_mode": "files",
            "fetch_version": false
          },
          "style": "powerline",
          "template": " \uf0e7{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
          "type": "azfunc"
        },
        {
          "background_templates": [
            "{{if contains \"default\" .Profile}}#FFA400{{end}}",
            "{{if contains \"jan\" .Profile}}#f1184c{{end}}"
          ],
          "foreground": "#ffffff",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "display_default": false
          },
          "style": "powerline",
          "template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
          "type": "aws"
        },
        {
          "background": "#ffff66",
          "foreground": "#111111",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "template": " \uf0ad ",
          "type": "root"
        },
        {
          "background": "#fbc718",
          "foreground": "#679c2f",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "template": " {{ .Env.OMP_VISERVER }} ",
          "type": "text"
        },
        {
          "background": "#105aa7",
          "foreground": "#74b05c",
          "powerline_symbol": "\ue0b0",
          "style": "powerline",
          "template": " {{ .Env.OMP_ANYCONNECT }} ",
          "type": "text"
        },
        {
          "background": "#83769c",
          "foreground": "#ffffff",
          "properties": {
            "always_enabled": true
          },
          "style": "plain",
          "template": "<transparent>\ue0b0</> \ufbab{{ .FormattedMs }}\u2800",
          "type": "executiontime"
        },
        {
          "background": "#00897b",
          "background_templates": [
            "{{ if gt .Code 0 }}#e91e63{{ end }}"
          ],
          "foreground": "#ffffff",
          "properties": {
            "always_enabled": true
          },
          "style": "diamond",
          "template": "<parentBackground>\ue0b0</> \ue23a ",
          "trailing_diamond": "\ue0b4",
          "type": "exit"
        }
      ],
      "type": "prompt"
    },
    {
      "segments": [
        {
          "background": "#0077c2",
          "foreground": "#ffffff",
          "style": "plain",
          "template": "<#0077c2,transparent>\ue0b6</> \uf489 {{ .Name }} <transparent,#0077c2>\ue0b2</>",
          "type": "shell"
        },
        {
          "background": "#1BD760",
          "foreground": "#111111",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "paused_icon": "\uf04c ",
            "playing_icon": "\uf04b "
          },
          "style": "powerline",
          "template": "\uf9c6 {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} ",
          "type": "spotify"
        },
        {
          "background": "#f36943",
          "background_templates": [
            "{{if eq \"Charging\" .State.String}}#40c4ff{{end}}",
            "{{if eq \"Discharging\" .State.String}}#ff5722{{end}}",
            "{{if eq \"Full\" .State.String}}#4caf50{{end}}"
          ],
          "foreground": "#ffffff",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "charged_icon": "\ue22f ",
            "charging_icon": "\ue234 ",
            "discharging_icon": "\ue231 "
          },
          "style": "powerline",
          "template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 ",
          "type": "battery"
        },
        {
          "background": "#2e9599",
          "foreground": "#111111",
          "invert_powerline": true,
          "leading_diamond": "\ue0b2",
          "style": "diamond",
          "template": " {{ .CurrentDate | date .Format }} ",
          "trailing_diamond": "\ue0b4",
          "type": "time"
        }
      ],
      "type": "rprompt"
    }
  ],
  "console_title_template": "{{ .Shell }} in {{ .Folder }}",
  "error_line": {
    "background": "transparent",
    "foreground": "#ffffff",
    "template": "<#83769c,#286983>\ue0b0 </><#eb6f92,#286983>\ue009 </><#286983,transparent>\ue0b4</> "
  },
  "final_space": true,
  "secondary_prompt": {
    "background": "transparent",
    "foreground": "#c386f1",
    "template": "-> "
  },
  "transient_prompt": {
    "background": "transparent",
    "foreground": "#ffffff",
    "template": "{{ .Shell }} {{ .Code }}> "
  },
  "valid_line": {
    "background": "transparent",
    "foreground": "#ffffff",
    "template": "<#83769c,#286983>\ue0b0 </><#e0def4,#286983>\uf42e </><#286983,transparent>\ue0b4</> "
  },
  "version": 2
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell ( Powershell Core 7.2.2 )

Log output

Output from oh-my-posh debug

Version: 7.59.4

Segments:

ConsoleTitle(true)   -   0 ms - pwsh in \\localhost\c$
session(true)        -   0 ms -  user 
path(true)           -   0 ms -        localhost  c$ 
git(false)           -  17 ms - 
node(false)          -   4 ms - 
go(false)            -   1 ms - 
julia(false)         -   0 ms - 
python(false)        -   1 ms - 
ruby(false)          -   1 ms - 
azfunc(false)        -   0 ms - 
aws(false)           -   0 ms - 
root(false)          -   0 ms - 
text(false)          -   0 ms -   
text(false)          -   1 ms -   
executiontime(true)  -   0 ms -  ﮫ0ms⠀
exit(true)           -   0 ms -   
shell(true)          -   0 ms -   pwsh 
spotify(true)        -   6 ms - 阮  Spoon - Outlier 
battery(true)        -   7 ms -   96 
time(true)           -   0 ms -  12:43:44 

Run duration: 44.2036ms

Cache path: C:\Users\user\AppData\Local\oh-my-posh

Logs:

2022/04/06 12:43:44 Flags duration: 0s, args: 
2022/04/06 12:43:44 Flags duration: 0s, args: 
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 503.6┬╡s, args: OMP_CACHE_DISABLED
2022/04/06 12:43:44 Root duration: 0s, args: 
2022/04/06 12:43:44 Shell duration: 0s, args: 
2022/04/06 12:43:44 ErrorCode duration: 0s, args: 
2022/04/06 12:43:44 IsWsl duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: User
user
2022/04/06 12:43:44 User duration: 0s, args: 
2022/04/06 12:43:44 debug: Host
P1IT570L
2022/04/06 12:43:44 Host duration: 502.9┬╡s, args: 
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 502.9┬╡s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: SSH_CONNECTION
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: SSH_CLIENT
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 Flags duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 IsWsl duration: 0s, args: 
2022/04/06 12:43:44 StackCount duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 HasCommand duration: 16.6837ms, args: git.exe
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 error: HasParentFilePath
CreateFile \\localhost\c$\.git: The system cannot find the file specified.
2022/04/06 12:43:44 HasParentFilePath duration: 0s, args: .git
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 1.2789ms, args: *.js
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 1.9395ms, args: *.ts
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: package.json
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: .nvmrc
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 63.5┬╡s, args: pnpm-workspace.yaml
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: .pnpmfile.cjs
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 503.8┬╡s, args: .npmrc
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 70.2┬╡s, args: .vue
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 581.7┬╡s, args: *.go
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 503.8┬╡s, args: go.mod
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 523.9┬╡s, args: *.jl
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 521.7┬╡s, args: *.py
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 519┬╡s, args: *.ipynb
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: pyproject.toml
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 522.6┬╡s, args: venv.bak
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: venv
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: .venv
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 523.3┬╡s, args: *.rb
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: Rakefile
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: Gemfile
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 520.8┬╡s, args: host.json
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: local.settings.json
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 PathSeparator duration: 0s, args: 
2022/04/06 12:43:44 debug: HasFiles
false
2022/04/06 12:43:44 HasFiles duration: 0s, args: function.json
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: AWS_VAULT
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: AWS_PROFILE
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: AWS_REGION
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: AWS_DEFAULT_REGION
2022/04/06 12:43:44 debug: Getenv

2022/04/06 12:43:44 Getenv duration: 0s, args: AWS_CONFIG_FILE
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 error: FileContent
open C:\Users\user/.aws/config: The system cannot find the path specified.
2022/04/06 12:43:44 FileContent duration: 0s, args: C:\Users\user/.aws/config
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 Root duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 ExecutionTime duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 ErrorCode duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 Shell duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 WindowTitle duration: 6.511ms, args: ^(Spotify.*)|(.*\s-\s.*)$
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 IsWsl duration: 0s, args: 
2022/04/06 12:43:44 BatteryInfo duration: 6.1216ms, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Pwd
\\localhost\c$
2022/04/06 12:43:44 Pwd duration: 0s, args: 
2022/04/06 12:43:44 debug: Home
C:\Users\user
2022/04/06 12:43:44 GOOS duration: 0s, args: 
2022/04/06 12:43:44 TemplateCache duration: 0s, args: 
2022/04/06 12:43:44 debug: Getenv
C:\Users\user\AppData\Local
2022/04/06 12:43:44 Getenv duration: 0s, args: LOCALAPPDATA
2022/04/06 12:43:44 CachePath duration: 0s, args:

Friendly Output from Write-PoshDebug

MethodInvocationException:
Line |
  17 |      $_ = $Process.Start();
     |      ~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Start" with "0" argument(s): "An error occurred trying to start process 'C:/Users/user/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' with working directory 'Microsoft.PowerShell.Core\FileSystem::\\localhost\c$'. The directory name is invalid."
MethodInvocationException:
Line |
  18 |      $_ = $Process.WaitForExit();
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
InvalidOperation:
Line |
  19 |      $stderr = $Process.StandardError.ReadToEnd().Trim()
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
InvalidOperation:
Line |
  23 |      return $Process.StandardOutput.ReadToEnd()
     |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

Output from $error[0] | select *

ErrorRecord                 : Exception calling "Start" with "0" argument(s): "An error occurred trying to start process
                              'C:/Users/user/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' with working directory 'Microsoft.PowerShell.Core\FileSystem::\\localhost\c$'. The
                              directory name is invalid."
WasThrownFromThrowStatement : False
TargetSite                  : System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject] Invoke(System.Collections.IEnumerable)
Message                     : Exception calling "Start" with "0" argument(s): "An error occurred trying to start process
                              'C:/Users/user/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' with working directory 'Microsoft.PowerShell.Core\FileSystem::\\localhost\c$'. The
                              directory name is invalid."
Data                        : {System.Management.Automation.Interpreter.InterpretedFrameInfo}
InnerException              : System.ComponentModel.Win32Exception (267): An error occurred trying to start process
                              'C:/Users/user/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' with working directory 'Microsoft.PowerShell.Core\FileSystem::\\localhost\c$'. The
                              directory name is invalid.
                                 at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
                                 at System.Diagnostics.Process.Start()
                                 at CallSite.Target(Closure , CallSite , Object )
HelpLink                    :
Source                      : System.Management.Automation
HResult                     : -2146233087
StackTrace                  :    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
                                 at System.Management.Automation.Runspaces.Pipeline.Invoke()
                                 at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options)

Output from $error[0].errorrecord | select *

PSMessageDetails      :
Exception             : System.Management.Automation.ParentContainsErrorRecordException: Exception calling "Start" with "0" argument(s): "An error occurred trying to start process
                        'C:/Users/user/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' with working directory 'Microsoft.PowerShell.Core\FileSystem::\\localhost\c$'. The
                        directory name is invalid."
TargetObject          :
CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : Win32Exception
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at global:Start-Utf8Process, <No file>: line 17
                        at <ScriptBlock>, <No file>: line 112
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Output from $error[0].innerexception | select *

NativeErrorCode : 267
ErrorCode       : -2147467259
TargetSite      : Boolean StartWithCreateProcess(System.Diagnostics.ProcessStartInfo)
Message         : An error occurred trying to start process 'C:/Users/user/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' with working directory
                  'Microsoft.PowerShell.Core\FileSystem::\\localhost\c$'. The directory name is invalid.
Data            : {}
InnerException  :
HelpLink        :
Source          : System.Diagnostics.Process
HResult         : -2147467259
StackTrace      :    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
                     at CallSite.Target(Closure , CallSite , Object )

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Closing this for now as everything works. Thanks all!

@lnu my bet is that this is related to the process invocation. I’ll try to see how to resolve this.

I did notice one can avoid the if and convert-path with the below. I did leave a review on the aforementioned pull request. It may be more or less inconsequential at this point though.

(Get-Location -PSProvider FileSystem).ProviderPath

Yes, that’s also how we get the actual path (which apparently sometimes returns an object rather that a string if I’m not mistaken).

@mattcargile fixed for unc path… if you have any other pwsh “exotic” scenarios, you’re welcome 😃

@lnu check what I did in the past for $PSWD in the init script. That could work.

I think convert-path is better… but I did not try yet with other exotic path like registry. And for unc path, I’m fixing a small issue with agnoster style path truncating the \