JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

Getting Fatal Error #4096

Closed Cr4ck3rs closed 1 year ago

Cr4ck3rs commented 1 year ago

Code of Conduct

What happened?

I'm getting the following error at random when using the terminal

`oh-my-posh fatal error rendering session segment:runtime error: invalid memory address or nil pointer dereference

goroutine 6 [running]: runtime/debug.Stack() /opt/hostedtoolcache/go/1.18.0/x64/src/runtime/debug/stack.go:24 +0x65 oh-my-posh/engine.(Segment).renderText.func1() /home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:326 +0x58 panic({0xcc0b40, 0x1776900}) /opt/hostedtoolcache/go/1.18.0/x64/src/runtime/panic.go:838 +0x207 strings.Count({0x0?, 0xc0000980c0?}, {0xd5a548?, 0xc00009a030?}) /opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:47 +0x50 strings.Replace({0x0, 0x15}, {0xd5a548, 0x1}, {0xd5a532, 0x1}, 0xffffffffffffffff) /opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:1003 +0xcf strings.ReplaceAll(...) /opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:1037 oh-my-posh/environment.DirMatchesOneOf({0xe902f0, 0xc00021c150}, {0x0?, 0xe?}, {0x17e3d40, 0x0, 0x0?}) /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:724 +0x76 oh-my-posh/engine.(Segment).cwdExcluded(0xc0001e2500) /home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:209 +0xde oh-my-posh/engine.(Segment).shouldIncludeFolder(0xc0001e2500) /home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:182 +0x36 oh-my-posh/engine.(Segment).renderText(0xc0001e2500, {0xe902f0?, 0xc00021c150?}) /home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:332 +0x7b oh-my-posh/engine.(Block).renderSegmentsText.func1(0x0?) /home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:88 +0x65 created by oh-my-posh/engine.(Block).renderSegmentsText /home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:86 +0x98`

Theme

a variation of slimfat: { "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "background": "#2f2f2f", "foreground": "#fafafa", "leading_diamond": "\ue0c7\u2593", "style": "diamond", "template": "{{ if ne .Env.POSH_SESSION_DEFAULT_USER .UserName }}<#77f5d6>{{ .UserName }}</><#7a7a7a>\uf1fa</><#2EEFBF>{{ .HostName }}{{ end }}</><#7a7a7a>\ue0b1</>", "type": "session" }, { "background": "#2f2f2f", "foreground": "#ffff66", "style": "diamond", "template": " \uf0e7<#7a7a7a> \ue0b1</>", "type": "root" }, { "background": "#2f2f2f", "foreground": "#fafafa", "properties": { "folder_icon": "<#B5B2C2>\uf141</>", "style": "agnoster_short", "home_icon": "\ueb06", "folder_separator_icon": " \ue0b1 ", "max_depth":2, "mapped_locations": { "C:\\Users\\jorge.aguero\\Documents\\workspace": "\uf40e", "C:\\Users\\jorge.aguero\\Documents\\workspace\\JMF": "\uf1b9" } }, "style": "diamond", "template": "<#f2f200> \ue5ff </>{{ .Path }} ", "type": "path" } ], "type": "prompt" }, { "alignment": "right", "segments": [ { "background": "#2f2f2f", "foreground": "#fafafa", "properties": { "time_format": "15:04" }, "style": "diamond", "template": "<#7a7a7a>\ue0b3</>{{ .CurrentDate | date .Format }}<#007ACC> \ue641 </>", "trailing_diamond": "\u2593\ue0c6", "type": "time" } ], "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "background": "#2f2f2f", "foreground": "#ffeb3b", "foreground_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}#ffeb3b{{ end }}", "{{ if gt .Ahead 0 }}#2EC4B6{{ end }}", "{{ if gt .Behind 0 }}#8A4FFF{{ end }}" ], "properties": { "fetch_stash_count": true, "fetch_status": true, "fetch_upstream_icon": true }, "style": "diamond", "template": "<#7a7a7a>\ue0b1 </>{{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }}<#E84855> \uf044 {{ .Working.String }}</>{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}<#2FDA4E> \uf046 {{ .Staging.String }}</>{{ end }}{{ if gt .StashCount 0 }} \uea98 {{ .StashCount }}{{ end }} ", "type": "git" } ], "type": "prompt" }, { "alignment": "right", "segments": [ { "background": "#2f2f2f", "foreground": "#6CA35E", "style": "diamond", "template": "<#7a7a7a>\ue0b3</> \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ", "type": "node" }, { "background": "#2f2f2f", "foreground": "#c019c3", "style": "diamond", "template": "<#7a7a7a>\ue0b3</> \ue77f ", "type": "dotnet" }, { "type": "azfunc", "style": "diamond", "foreground": "#c2d215", "background": "#2f2f2f", "template": "<#7a7a7a>\ue0b3</> \uf0e7 ", "properties": { "fetch_version": false, "display_mode": "files" } } ], "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "foreground": "#30cf18", "style": "plain", "template": " ~#@\u276f", "type": "text" } ], "type": "prompt" }, { "alignment": "right", "segments": [ { "foreground": "#FFCE5C", "properties": { "style": "roundrock", "threshold": 500 }, "style": "plain", "template": " {{ .FormattedMs }}<#fafafa> \uf252 </>", "type": "executiontime" } ], "type": "rprompt" } ], "console_title_template": "{{if .Root}}root :: {{end}}{{.Shell}} :: {{.Folder}}", "final_space": true, "version": 2 }

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 7.59.0

Segments:

ConsoleTitle(true)   -   0 ms - pwsh :: ~
session(true)        -   0 ms - ▓jorge.agueroPE
root(false)          -   0 ms -
path(true)           -   0 ms -   
time(true)           -   0 ms - 11:41  ▓
git(false)           -  18 ms -
node(false)          -   0 ms -
dotnet(false)        -   0 ms -
azfunc(false)        -   0 ms -
text(true)           -   0 ms -  ~#@❯
executiontime(false) -   0 ms -

Run duration: 19.0085ms

Cache path: C:\Users\jorge.aguero\AppData\Local\oh-my-posh

Logs:

2023/07/26 11:41:58 Flags duration: 0s, args:
2023/07/26 11:41:58 Flags duration: 0s, args:
2023/07/26 11:41:58 debug: Getenv

2023/07/26 11:41:58 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2023/07/26 11:41:58 Root duration: 0s, args:
2023/07/26 11:41:58 Shell duration: 0s, args:
2023/07/26 11:41:58 ErrorCode duration: 0s, args:
2023/07/26 11:41:58 IsWsl duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 PathSeparator duration: 0s, args:
2023/07/26 11:41:58 PathSeparator duration: 0s, args:
2023/07/26 11:41:58 debug: User
jorge.aguero
2023/07/26 11:41:58 User duration: 0s, args:
2023/07/26 11:41:58 debug: Host
PE-IT000927
2023/07/26 11:41:58 Host duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 TemplateCache duration: 501.7µs, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Getenv

2023/07/26 11:41:58 Getenv duration: 0s, args: SSH_CONNECTION
2023/07/26 11:41:58 debug: Getenv

2023/07/26 11:41:58 Getenv duration: 0s, args: SSH_CLIENT
2023/07/26 11:41:58 TemplateCache duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 Root duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 Flags duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 PathSeparator duration: 0s, args:
2023/07/26 11:41:58 Flags duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 PathSeparator duration: 0s, args:
2023/07/26 11:41:58 PathSeparator duration: 0s, args:
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 IsWsl duration: 0s, args:
2023/07/26 11:41:58 StackCount duration: 0s, args:
2023/07/26 11:41:58 TemplateCache duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 TemplateCache duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 GOOS duration: 0s, args:
2023/07/26 11:41:58 HasCommand duration: 16.0256ms, args: git.exe
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2023/07/26 11:41:58 HasParentFilePath duration: 1.9827ms, args: .git
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 TemplateCache duration: 0s, args:
2023/07/26 11:41:58 debug: Pwd
C:\Users\jorge.aguero
2023/07/26 11:41:58 Pwd duration: 0s, args:
2023/07/26 11:41:58 debug: Home
C:\Users\jorge.aguero
2023/07/26 11:41:58 ExecutionTime duration: 0s, args:
2023/07/26 11:41:58 debug: Getenv
C:\Users\jorge.aguero\AppData\Local
2023/07/26 11:41:58 Getenv duration: 0s, args: LOCALAPPDATA
2023/07/26 11:41:58 CachePath duration: 0s, args:
JanDeDobbeleer commented 1 year ago

@Cr4ck3rs you have a very old version of oh-my-posh (Version: 7.59.0) This has been solved along time ago.

Cr4ck3rs commented 1 year ago

ohh that makes sense, thanks a lot! will try to update

Cr4ck3rs commented 1 year ago

That was it, it also fixed some issues with some glyphs not showing up

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.