JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer

Home Page:https://ohmyposh.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prompt not displayed from 21.23.3

dpokluda opened this issue · comments

Code of Conduct

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

What happened?

Today, after installing latest version of oh-my-posh, I don't see my prompt being rendered (only PS>). I have tried multiple versions, and it seems to start since 21.23.3 (it works with 21.23.2 but no version after). I tried to search for similar issues but didn't find anything relevant.

I am not sure if my custom theme contains anything special that is no longer supported but the version 21.23.3 doesn't talk about deprecating any previous feature.

When comparing debug output from 21.23.2 to newer version, I am noticing some changes but nothing that would clearly explain what is wrong (not working) in the current version.

Theme

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "type": "newline"
    },
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#7c7c7c",
          "foreground": "#2D2D2D",
          "properties": {
            "time_format": "15:04:05"
          },
          "style": "plain",
          "template": " {{ .CurrentDate | date .Format }} ",
          "type": "time"
        },
        {
          "background": "#3465A4",
          "properties": {
            "style": "full"
          },
          "style": "diamond",
          "template": " {{ .Path }} ",
          "trailing_diamond": "\ue0b0",
          "type": "path"
        },
        {
          "background": "#4E9A06",
          "background_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}#C4A000{{ end }}"
          ],
          "foreground": "#2D2D2D",
          "properties": {
            "branch_ahead_icon": "\u2191",
            "branch_behind_icon": "\u2193",
            "branch_gone": "\u2262",
            "branch_icon": "\ue0a0 ",
            "branch_identical_icon": "\u2261",
            "cherry_pick_icon": "\u2713 ",
            "commit_icon": "\u25b7 ",
            "merge_icon": "\u25f4 ",
            "no_commits_icon": "[no commits]",
            "rebase_icon": "\u2c62 ",
            "tag_icon": "\u25b6 "
          },
          "style": "powerline",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "style": "full"
          },
          "template": " {{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }}{{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} \u2502{{ end }}{{ if .Staging.Changed }}{{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}}{{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }} ",
          "type": "git"
        }
      ],
      "type": "prompt",
      "vertical_offset": 1
    },
    {
      "alignment": "left",
      "newline": true,
      "segments": [
        {
          "style": "plain",
          "type": "text",
          "template": "{{.Env._POSH_LOCATION_DEPTH}}"
        },
        {
          "style": "plain",
          "template": "\u276f",
          "type": "text"
        }
      ],
      "type": "prompt"
    }
  ],
  "console_title_template": "{{.PWD}}",
  "final_space": true,
  "shell_integration": true,
  "osc99": true,
  "version": 2
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 21.26.2

Shell: pwsh (7.4.3)

Prompt:


 15:58:05  D:\Scripts   main  
❯

Segments:

ConsoleTitle(true)                        -   0 ms
Time(true)                                -   0 ms
Path(true)                                -   1 ms
Git(true)                                 -   2 ms
Text(true)                                -   0 ms

Run duration: 16.5989ms

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

Config path: C:\Users\davidpokluda\OneDrive\Documents\PowerShell\dpokluda-pwsh.omp.json

Logs:

[DEBUG] 15:58:05.794 os.go:Getenv:306 → C:\Users\davidpokluda\AppData\Local
[TRACE] 15:58:05.795 os.go:Getenv(LOCALAPPDATA) - 509.4µs
[TRACE] 15:58:05.795 os_windows.go:CachePath() - 509.4µs
[DEBUG] 15:58:05.795 os.go:Getenv:306 → C:\Users\davidpokluda\OneDrive\Documents\PowerShell\dpokluda-pwsh.omp.json
[TRACE] 15:58:05.795 os.go:Getenv(POSH_THEME) - 0s
[DEBUG] 15:58:05.795 os.go:Shell:581 → no shell name provided in flags, trying to detect it
[DEBUG] 15:58:05.799 os.go:Shell:589 → process name: pwsh.exe
[TRACE] 15:58:05.799 os.go:Shell() - 3.7173ms
[TRACE] 15:58:05.799 os.go:resolveConfigPath() - 3.7173ms
[TRACE] 15:58:05.799 os.go:Init() - 4.2267ms
[TRACE] 15:58:05.799 os.go:Flags() - 0s
[TRACE] 15:58:05.800 load.go:loadConfig() - 1.0217ms
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[TRACE] 15:58:05.800 os.go:Shell() - 0s
[DEBUG] 15:58:05.800 debug.go:44 → Terminal shell: %s shell
[DEBUG] 15:58:05.800 debug.go:44 → Terminal program: %s Windows Terminal
[DEBUG] 15:58:05.800 os.go:Getenv:306 → NO DATA
[TRACE] 15:58:05.800 os.go:Getenv(OMP_CACHE_DISABLED) - 0s
[TRACE] 15:58:05.800 os_windows.go:WindowsRegistryKeyValue(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor) - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[DEBUG] 15:58:05.800 os_windows.go:WindowsRegistryKeyValue:219 → ColorizationColor(DWORD): 0xC40078D4
[TRACE] 15:58:05.800 os.go:Shell() - 0s
[DEBUG] 15:58:05.800 os.go:Getenv:306 → 7.4.3
[TRACE] 15:58:05.800 os.go:Getenv(POSH_SHELL_VERSION) - 0s
[DEBUG] 15:58:05.800 debug.go:PrintDebug:23 → Segment: Title
[DEBUG] 15:58:05.800 text.go:Render:73 → Rendering template: {{.PWD}}
[TRACE] 15:58:05.800 os_windows.go:Root() - 0s
[TRACE] 15:58:05.800 os.go:Shell() - 0s
[TRACE] 15:58:05.800 os.go:StatusCodes() - 0s
[TRACE] 15:58:05.800 os_windows.go:IsWsl() - 0s
[DEBUG] 15:58:05.800 os.go:TemplateCache:789 → environment: [ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\davidpokluda\AppData\Roaming CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=DPOKLUDA ComSpec=C:\Windows\system32\cmd.exe CONDA_PROMPT_MODIFIER=False DOTNET_SUGGEST_SCRIPT_VERSION=1.0.0 DriverData=C:\Windows\System32\Drivers\DriverData HOMEDRIVE=C: HOMEPATH=\Users\davidpokluda LOCALAPPDATA=C:\Users\davidpokluda\AppData\Local LOGONSERVER=\\DPOKLUDA npm_config_cache=E:\Packages\npm\ NUGET_PACKAGES=E:\Packages\nuget\ NUMBER_OF_PROCESSORS=32 OneDrive=C:\Users\davidpokluda\OneDrive - Microsoft OneDriveCommercial=C:\Users\davidpokluda\OneDrive - Microsoft OneDriveConsumer=C:\Users\davidpokluda\OneDrive OS=Windows_NT Path=C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\GitHub CLI\;C:\Users\davidpokluda\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\davidpokluda\AppData\Local\Programs\Python\Python312\;C:\Users\davidpokluda\AppData\Local\Programs\Python\Launcher\;C:\Users\davidpokluda\scoop\shims;C:\Users\davidpokluda\AppData\Local\Microsoft\WindowsApps;C:\Users\davidpokluda\.dotnet\tools;C:\Users\davidpokluda\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\davidpokluda\AppData\Local\Programs\oh-my-posh\bin;C:\Program Files\Araxis\Araxis Merge;C:\Program Files\EditPadPro;C:\Program Files\Salamander;C:\Program Files\\dotnet\;C:\Program Files (x86)\_netTools\_framework;C:\Users\davidpokluda;C:\Users\davidpokluda\AppData\Local\JetBrains\Toolbox\scripts;;D:\Scripts PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL PIP_CACHE_DIR=E:\Packages\pip\ POSH_AZURE_ENABLED=False POSH_GIT_ENABLED=False POSH_INSTALLER=winget POSH_PID=22848 POSH_SHELL_VERSION=7.4.3 POSH_THEME=C:\Users\davidpokluda\OneDrive\Documents\PowerShell\dpokluda-pwsh.omp.json POSH_THEMES_PATH=C:\Users\davidpokluda\AppData\Local\Programs\oh-my-posh\themes POWERLINE_COMMAND=oh-my-posh POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Enterprise PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 183 Stepping 1, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=b701 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PSModulePath=C:\Users\davidpokluda\OneDrive - Microsoft\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules PUBLIC=C:\Users\Public SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\DAVIDP~1\AppData\Local\Temp TMP=C:\Users\DAVIDP~1\AppData\Local\Temp UATDATA=C:\Windows\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77 USERDNSDOMAIN=redmond.corp.microsoft.com USERDOMAIN=REDMOND USERDOMAIN_ROAMINGPROFILE=REDMOND USERNAME=davidpokluda USERPROFILE=C:\Users\davidpokluda VCPKG_DEFAULT_BINARY_CACHE=E:\Packages\vcpkg\ windir=C:\Windows WSLENV=WT_SESSION:WT_PROFILE_ID: WT_PROFILE_ID={574e775e-4f2a-5b96-ac1e-a2962a402336} WT_SESSION=559fb700-45c2-4739-b7dc-138e95448f19 ZES_ENABLE_SYSMAN=1]
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[DEBUG] 15:58:05.800 os.go:Pwd:336 → D:\Scripts
[TRACE] 15:58:05.800 os.go:Pwd() - 0s
[DEBUG] 15:58:05.800 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.800 os_windows.go:IsWsl() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[DEBUG] 15:58:05.800 os.go:User:474 → davidpokluda
[TRACE] 15:58:05.800 os.go:User() - 0s
[DEBUG] 15:58:05.800 os.go:Host:491 → DPOKLUDA
[TRACE] 15:58:05.800 os.go:Host() - 0s
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[DEBUG] 15:58:05.800 os.go:Getenv:306 → NO DATA
[TRACE] 15:58:05.800 os.go:Getenv(SHLVL) - 0s
[TRACE] 15:58:05.800 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.800 os.go:StatusCodes() - 0s
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[TRACE] 15:58:05.800 os.go:Shell() - 0s
[DEBUG] 15:58:05.800 os.go:Getenv:306 → NO DATA
[TRACE] 15:58:05.800 os.go:Getenv(POSH_CURSOR_LINE) - 0s
[DEBUG] 15:58:05.800 os.go:Getenv:306 → NO DATA
[TRACE] 15:58:05.800 os.go:Getenv(POSH_CURSOR_COLUMN) - 0s
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[TRACE] 15:58:05.800 os.go:Shell() - 0s
[TRACE] 15:58:05.800 os.go:Shell() - 0s
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[TRACE] 15:58:05.800 os.go:Pwd() - 0s
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[DEBUG] 15:58:05.800 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[DEBUG] 15:58:05.800 segment.go:SetEnabled:115 → Segment: Git
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[TRACE] 15:58:05.800 os.go:Pwd() - 0s
[DEBUG] 15:58:05.800 os.go:Getenv:306 → C:\Users\davidpokluda\AppData\Local
[TRACE] 15:58:05.800 os.go:Getenv(LOCALAPPDATA) - 0s
[DEBUG] 15:58:05.800 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.800 os.go:GOOS() - 0s
[DEBUG] 15:58:05.800 segment.go:SetEnabled:115 → Segment: Time
[DEBUG] 15:58:05.800 time.go:Enabled:29 → 15:04:05
[TRACE] 15:58:05.800 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.800 os.go:Flags() - 0s
[TRACE] 15:58:05.800 os.go:Pwd() - 0s
[DEBUG] 15:58:05.800 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[DEBUG] 15:58:05.801 segment.go:SetEnabled:115 → Segment: Path
[DEBUG] 15:58:05.801 path.go:124 → display_cygpath: false
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:PathSeparator() - 0s
[TRACE] 15:58:05.801 os.go:Pwd() - 0s
[TRACE] 15:58:05.801 os.go:Shell() - 0s
[TRACE] 15:58:05.801 os.go:Flags() - 0s
[DEBUG] 15:58:05.801 path.go:replaceMappedLocations:517 → mapped_locations_enabled: true
[DEBUG] 15:58:05.801 path.go:replaceMappedLocations:518 → 
[DEBUG] 15:58:05.801 path.go:replaceMappedLocations:519 → 
[DEBUG] 15:58:05.801 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[DEBUG] 15:58:05.801 path.go:replaceMappedLocations:520 → ~
[DEBUG] 15:58:05.801 path.go:replaceMappedLocations:525 → mapped_locations: map[]
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[TRACE] 15:58:05.801 os.go:GOOS() - 0s
[DEBUG] 15:58:05.801 path.go:makeFolderFormatMap:841 → NO DATA
[DEBUG] 15:58:05.801 path.go:setStyle:192 → full
[DEBUG] 15:58:05.801 path.go:colorizePath:715 → cycle: []
[DEBUG] 15:58:05.801 path.go:getFolderSeparator:250 → NO DATA
[DEBUG] 15:58:05.801 path.go:getFolderSeparator:252 → \
[DEBUG] 15:58:05.801 path.go:colorizePath:718 → cycle_folder_separator: false
[DEBUG] 15:58:05.801 path.go:colorizePath:719 → %s
[DEBUG] 15:58:05.801 path.go:colorizePath:721 → %s
[DEBUG] 15:58:05.801 path.go:colorizePath:722 → %s
[DEBUG] 15:58:05.801 path.go:colorizePath:723 → %s
[TRACE] 15:58:05.802 os.go:Pwd() - 0s
[TRACE] 15:58:05.802 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.802 os.go:StackCount() - 0s
[DEBUG] 15:58:05.802 win32_windows.go:isWriteable:303 → current user is member of S-1-5-32-544
[DEBUG] 15:58:05.802 win32_windows.go:isWriteable:311 ↓
    WRITE_DAC
    WRITE_OWNER
    SYNCHRONIZE
    DELETE
    READ_CONTROL
[DEBUG] 15:58:05.802 win32_windows.go:isWriteable:313 → user has write access
[TRACE] 15:58:05.802 os_windows.go:DirIsWritable() - 0s
[TRACE] 15:58:05.802 os.go:TemplateCache() - 0s
[DEBUG] 15:58:05.802 os.go:CommandPath:533 → C:\Program Files\Git\cmd\git.exe
[TRACE] 15:58:05.802 os.go:CommandPath(git.exe) - 2.05ms
[TRACE] 15:58:05.802 os.go:HasCommand(git.exe) - 2.05ms
[TRACE] 15:58:05.802 os.go:Pwd() - 0s
[DEBUG] 15:58:05.802 os.go:ResolveSymlink:433 → E:\Develop\Scripts\PowerShell
[TRACE] 15:58:05.802 os.go:ResolveSymlink(D:\Scripts) - 0s
[TRACE] 15:58:05.802 os.go:HasParentFilePath(.git) - 0s
[DEBUG] 15:58:05.802 scm.go:shouldIgnoreRootRepository:130 → exclude_folders: []
[DEBUG] 15:58:05.802 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[DEBUG] 15:58:05.802 git.go:Enabled:167 → fetch_user: false
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[DEBUG] 15:58:05.802 os.go:Getenv:306 → NO DATA
[TRACE] 15:58:05.802 os.go:Getenv(POSH_GIT_STATUS) - 0s
[DEBUG] 15:58:05.802 git.go:Enabled:186 → fetch_status: false
[DEBUG] 15:58:05.802 git.go:shouldIgnoreStatus:413 → ignore_status: []
[DEBUG] 15:58:05.802 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.802 os.go:GOOS() - 0s
[DEBUG] 15:58:05.802 os.go:FileContent:448 ↓
    ref: refs/heads/main

[TRACE] 15:58:05.802 os.go:FileContent(E:\Develop\Scripts\.git/HEAD) - 0s
[DEBUG] 15:58:05.802 git.go:setPrettyHEADName:756 → 
[DEBUG] 15:58:05.802 git.go:formatHEAD:724 → branch_max_length: 0
[DEBUG] 15:58:05.802 git.go:Enabled:197 → fetch_upstream_icon: false
[TRACE] 15:58:05.802 os.go:TemplateCache() - 0s
[DEBUG] 15:58:05.802 text.go:Render:73 → Rendering template:  {{ .CurrentDate | date .Format }}
[DEBUG] 15:58:05.802 text.go:Render:73 → Rendering template:  {{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }}{{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} │{{ end }}{{ if .Staging.Changed }}{{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}}{{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}}  {{ .WorktreeCount }}{{ end }}
[DEBUG] 15:58:05.802 text.go:Render:73 → Rendering template:  {{ .Path }}
[TRACE] 15:58:05.803 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.803 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.803 os.go:TemplateCache() - 0s
[ERROR] 15:58:05.811 os.go:FileContent:444 → open E:\Develop\Scripts\.git/logs/refs/stash: The system cannot find the file specified.
[TRACE] 15:58:05.811 os.go:FileContent(E:\Develop\Scripts\.git/logs/refs/stash) - 8.285ms
[DEBUG] 15:58:05.811 os.go:HasFolder:418 → false
[TRACE] 15:58:05.811 os.go:HasFolder(E:\Develop\Scripts\.git/worktrees) - 0s
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: plain
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: diamond
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: {{ if or (.Working.Changed) (.Staging.Changed) }}#C4A000{{ end }}
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: powerline
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: {{ if or (.Working.Changed) (.Staging.Changed) }}#C4A000{{ end }}
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: {{ if or (.Working.Changed) (.Staging.Changed) }}#C4A000{{ end }}
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.811 os.go:Shell() - 0s
[TRACE] 15:58:05.811 os.go:Flags() - 0s
[TRACE] 15:58:05.811 os.go:Pwd() - 0s
[DEBUG] 15:58:05.811 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.811 os.go:Pwd() - 0s
[TRACE] 15:58:05.811 os.go:GOOS() - 0s
[DEBUG] 15:58:05.811 segment.go:SetEnabled:115 → Segment: Text
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[DEBUG] 15:58:05.811 os_windows.go:58 → C:\Users\davidpokluda
[TRACE] 15:58:05.811 os.go:GOOS() - 0s
[DEBUG] 15:58:05.811 segment.go:SetEnabled:115 → Segment: Text
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: ❯
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: {{.Env._POSH_LOCATION_DEPTH}}
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.811 os.go:TemplateCache() - 0s
[TRACE] 15:58:05.811 os.go:Shell() - 0s
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: plain
[DEBUG] 15:58:05.811 text.go:Render:73 → Rendering template: plain
[TRACE] 15:58:05.811 os.go:Shell() - 0s
[TRACE] 15:58:05.811 os.go:Flags() - 0s
[TRACE] 15:58:05.811 os.go:Shell() - 0s
[TRACE] 15:58:05.811 os.go:Pwd() - 0s
[TRACE] 15:58:05.811 os.go:Shell() - 0s
[DEBUG] 15:58:05.811 os.go:Getenv:306 → C:\Users\davidpokluda\AppData\Local
[TRACE] 15:58:05.811 os.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 15:58:05.811 os_windows.go:CachePath() - 0s
[TRACE] 15:58:05.811 os.go:Flags() - 0s

I am experiencing the same issue. For me it also started to happen from version 21.23.3

In my case prompt theme is being fully reset when we try to override Function:Prompt (which worked perfectly before the update 21.23.3 and further updates).

$currentPrompt = Get-Content Function:Prompt
$currentPromptText = $currentPrompt.ToString()
$currentPromptText += "SOME CODE"
$newPrompt = [scriptblock]::Create($currentPromptText)
Set-Item -Path Function:prompt -Value $newPrompt -Force

Content of Function:Prompt

        # store the orignal last command execution status
        if ($global:NVS_ORIGINAL_LASTEXECUTIONSTATUS -is [bool]) {
            # make it compatible with NVS auto-switching, if enabled
            $script:OriginalLastExecutionStatus = $global:NVS_ORIGINAL_LASTEXECUTIONSTATUS
        }
        else {
            $script:OriginalLastExecutionStatus = $?
        }
        # store the orignal last exit code
        $script:OriginalLastExitCode = $global:LASTEXITCODE

        Set-PoshPromptType
        if ($script:PromptType -ne 'transient') {
            Update-PoshErrorCode
        }
        $cleanPSWD = Get-CleanPSWD
        $stackCount = global:Get-PoshStackCount
        Set-PoshContext
        $terminalWidth = Get-TerminalWidth

        # set the cursor positions, they are zero based so align with other platforms
        $env:POSH_CURSOR_LINE = $Host.UI.RawUI.CursorPosition.Y + 1
        $env:POSH_CURSOR_COLUMN = $Host.UI.RawUI.CursorPosition.X + 1

        $standardOut = Start-Utf8Process $script:OMPExecutable @("print", $script:PromptType, "--status=$script:ErrorCode", "--pswd=$cleanPSWD", "--execution-time=$script:ExecutionTime", "--stack-count=$stackCount", "--config=$env:POSH_THEME", "--shell-version=$script:PSVersion", "--terminal-width=$terminalWidth", "--shell=$script:ShellName", "--no-status=$script:NoExitCode")
        # make sure PSReadLine knows if we have a multiline prompt
        Set-PSReadLineOption -ExtraPromptLineCount (($standardOut | Measure-Object -Line).Lines - 1)

        # The output can be multi-line, joining them ensures proper rendering.
        $standardOut -join "`n"

        # remove any posh-git status
        $env:POSH_GIT_STATUS = $null

        # restore the orignal last exit code
        $global:LASTEXITCODE = $script:OriginalLastExitCode

I tested scenario when I updated Function:Prompt value without any changes, and theme resets in this case too.

$currentPrompt = Get-Content Function:Prompt
$currentPromptText = $currentPrompt.ToString()
$newPrompt = [scriptblock]::Create($currentPromptText)
Set-Item -Path Function:prompt -Value $newPrompt -Force

Maybe this information will be useful to debug

Reproduced on my end. We've done some changes related to the prompt function in PowerShell. Will try to fix it.

$currentPrompt = Get-Content Function:Prompt
$currentPromptText = $currentPrompt.ToString()
$currentPromptText += "SOME CODE"
$newPrompt = [scriptblock]::Create($currentPromptText)
Set-Item -Path Function:prompt -Value $newPrompt -Force

@nbdinara Are you sure the above code worked before? I tested it but it didn't even work (resulting in a fallback prompt PS>) in v21.23.2. 🤔

@lewis-yeung , this is what I see:

v21.23.2 - theme is not being reset
image

v21.23.3 - theme is being reset
image

On screenshots above I execute function that has code I specified above (and you can see the function content on the screenshots as well). You can see that everything worked fine on version 21.23.2. On version 21.23.3 theme is being reset after function execution.

But it is interesting that if I run code line by line in console window instead of using function, theme is being reset even if the version of oh-my-posh is v21.23.2.

image

@nbdinara I still cannot get the example to work in v21.23.2, either in a function or running line by line. What's your PowerShell version?

@dpokluda @nbdinara What does the $error variable hold when you have a broken prompt?

@nbdinara This should be a scope related issue. Many OMP functions called inside the prompt function are defined in a module scope, thus cannot be called outside when running the above example. I'm curious why it works in v21.23.2 on your machine.

image
Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
image
ErrorRecord                 : The term 'Set-PoshPromptType' is not recognized as a name of a cmdlet, function, script
                              file, or executable program.
                              Check the spelling of the name, or if a path was included, verify that the path is
                              correct and try again.
CommandName                 : Set-PoshPromptType
WasThrownFromThrowStatement : False
TargetSite                  : System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject]
                              Invoke(System.Collections.IEnumerable)
Message                     : The term 'Set-PoshPromptType' is not recognized as a name of a cmdlet, function, script
                              file, or executable program.
                              Check the spelling of the name, or if a path was included, verify that the path is
                              correct and try again.
Data                        : {[System.Management.Automation.Interpreter.InterpretedFrameInfo,
                              System.Management.Automation.Interpreter.InterpretedFrameInfo[]]}
InnerException              :
HelpLink                    :
Source                      : System.Management.Automation
HResult                     : -2146233087
StackTrace                  :    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
                                 at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline,
                              Exception& exceptionThrown, ExecutionOptions options)

Set-PoshPromptType:
Line |
  13 |          Set-PoshPromptType
     |          ~~~~~~~~~~~~~~~~~~
     | The term 'Set-PoshPromptType' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Test-Path: Value cannot be null. (Parameter 'The provided Path argument was null or an empty collection.')

Got the same error on PowerShell v7.4.3:

The term 'Set-PoshPromptType' is not recognized as a name of a cmdlet, function, script file, or executable program.

@nbdinara If you would like to wrap the prompt function, it's better to write something like:

$originalPromptFunction = $Function:prompt
function prompt {
  $originalOutput = $originalPromptFunction.Invoke()
  # Some code...
}

@nbdinara I had a few debug runs here and it's safe to say this isn't supported. There are so many side effects here when hijacking the prompt function, if you want to display additional text it's better to override Set-PoshContext to add specific, non built-in context instead of hacking the prompt yourself (see here for more information). That will always have challenges. Even when we export every function, it still breaks. I also can't make that work on older version as it is indeed a scope issue, something that wasn't introduced in that version but way back.