Closed theconnstruct closed 2 years ago
Of note, I also use the same theme inside several WSL instances and on a few Linux servers. In Windows/Powershell is the only time I see this behavior.
I also noticed this a few days ago. Happened to me on windows, never on MacOS.
Might be related to updating some dependencies, will check (nil pointers are identifiable luckily).
@lnu @cyveris looking at that I have no idea what's causing this, it's a good idea anyways to add the stack trace to the error so we have a clue of what's going on when it happens again.
Just noticed this for the first time, with the following stack trace:
❯ cd Pli
oh-my-posh fatal error rendering git segment:runtime error: invalid memory address or nil pointer dereference
goroutine 8 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.17.3/x64/src/runtime/debug/stack.go:24 +0x65
main.(*Segment).setStringValue.func1()
/home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:287 +0x58
panic({0xd43cc0, 0x17100b0})
/opt/hostedtoolcache/go/1.17.3/x64/src/runtime/panic.go:1038 +0x215
main.(*GitStatus).Changed(...)
/home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:35
main.(*git).deprecatedString(0xc00030a000, 0xfa)
/home/runner/work/oh-my-posh/oh-my-posh/src/segment_deprecated.go:92 +0x131
main.(*git).string(0xc00030a000)
/home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:206 +0x2b1
main.(*Segment).string(...)
/home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:141
main.(*Segment).setStringValue(0xc0001cc900, {0xea8500, 0xc00006eb90})
/home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:297 +0xc5
main.(*Block).setStringValues.func1(0x0)
/home/runner/work/oh-my-posh/oh-my-posh/src/block.go:87 +0x65
created by main.(*Block).setStringValues
/home/runner/work/oh-my-posh/oh-my-posh/src/block.go:85 +0x9d
~\Development\Pandell\Pli error
❯
it's an issue with the latest changes. @JanDeDobbeleer has been notified. https://github.com/JanDeDobbeleer/oh-my-posh/commit/04f841d1b323f58e8e1b7c33f96eae26ea00558b.
For the time being rollback to a previous version, the fix is on its way.
Getting the same when running Get-PoshThemes in WindowsTerminal on Win11
Theme: atomic
oh-my-posh fatal error rendering git segment:runtime error: invalid memory address or nil pointer dereference
goroutine 9 [running]: runtime/debug.Stack() /opt/hostedtoolcache/go/1.17.3/x64/src/runtime/debug/stack.go:24 +0x65 main.(Segment).setStringValue.func1() /home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:287 +0x58 panic({0xb73cc0, 0x15400b0}) /opt/hostedtoolcache/go/1.17.3/x64/src/runtime/panic.go:1038 +0x215 main.(GitStatus).add(...) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:30 main.(git).setGitStatus.func1({0xc000330239, 0x2}) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:274 +0x13b main.(git).setGitStatus(0xc0002700f0) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:305 +0x3c8 main.(git).string(0xc0002700f0) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:183 +0xc5 main.(Segment).string(...) /home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:141 main.(Segment).setStringValue(0xc0001d4c00, {0xcd8500, 0xc000078b90}) /home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:297 +0xc5 main.(Block).setStringValues.func1(0x0) /home/runner/work/oh-my-posh/oh-my-posh/src/block.go:87 +0x65 created by main.(*Block).setStringValues /home/runner/work/oh-my-posh/oh-my-posh/src/block.go:85 +0x9d
╭─ pwsh SpaceEngineers error 羽0ms⠀ 99 8,14:39 ╰─ff
Theme: atomicBit
oh-my-posh fatal error rendering git segment:runtime error: invalid memory address or nil pointer dereference
goroutine 118 [running]: runtime/debug.Stack() /opt/hostedtoolcache/go/1.17.3/x64/src/runtime/debug/stack.go:24 +0x65 main.(Segment).setStringValue.func1() /home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:287 +0x58 panic({0xb73cc0, 0x15400b0}) /opt/hostedtoolcache/go/1.17.3/x64/src/runtime/panic.go:1038 +0x215 main.(GitStatus).add(...) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:30 main.(git).setGitStatus.func1({0xc00044c079, 0x2}) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:274 +0x13b main.(git).setGitStatus(0xc000416000) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:305 +0x3c8 main.(git).string(0xc000416000) /home/runner/work/oh-my-posh/oh-my-posh/src/segment_git.go:183 +0xc5 main.(Segment).string(...) /home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:141 main.(Segment).setStringValue(0xc00024f000, {0xcd8500, 0xc000078b90}) /home/runner/work/oh-my-posh/oh-my-posh/src/segment.go:297 +0xc5 main.(Block).setStringValues.func1(0x0) /home/runner/work/oh-my-posh/oh-my-posh/src/block.go:87 +0x65 created by main.(*Block).setStringValues /home/runner/work/oh-my-posh/oh-my-posh/src/block.go:85 +0x9d
╭─[vegar@Photo-PC]─[SpaceEngineers] ()─[ 99%]─[ 8,14:39] ╰─[error]-ff
The fix is building
Status update: GitHub Releases is experiencing issues, I unlisted this release and the Powershell module so stay tuned.
Status update: fix is available
I have the same issue, just downloaded oh-my-posh
today; it happens on all themes I've tried (default, the bubbles
family, atomic
, etc.). I'm using it in Nu on Windows Terminal.
@Kyllingene can you share your config ?
My Nu config is just this: prompt = "(oh-my-posh --config C:/Users/josia/scoop/apps/oh-my-posh/current/themes/<theme>.json | str collect)"
@Kyllingene do you also have a stacktrace? Because it should print it (provided oh-my-posh is up to date).
goroutine 19 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.17.7/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:332 +0x58
panic({0xd0fbe0, 0x17cdb50})
/opt/hostedtoolcache/go/1.17.7/x64/src/runtime/panic.go:1038 +0x215
strings.Count({0x0, 0xc00002e0c0}, {0xda423d, 0xc00002e090})
/opt/hostedtoolcache/go/1.17.7/x64/src/strings/strings.go:47 +0x50
strings.Replace({0x0, 0x0}, {0xda423d, 0x1}, {0xda4227, 0x1}, 0xffffffffffffffff)
/opt/hostedtoolcache/go/1.17.7/x64/src/strings/strings.go:930 +0xcc
strings.ReplaceAll(...)
/opt/hostedtoolcache/go/1.17.7/x64/src/strings/strings.go:964
oh-my-posh/environment.DirMatchesOneOf({0xec29f8, 0xc0000dade0}, {0x0, 0xe}, {0x1839080, 0x0, 0x0})
/home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:699 +0x76
oh-my-posh/engine.(*Segment).cwdExcluded(0xc0001c9e60)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:200 +0xde
oh-my-posh/engine.(*Segment).shouldIncludeFolder(0xc0001c9e60)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:173 +0x2c
oh-my-posh/engine.(*Segment).renderText(0xc0001c9e60, {0xec29f8, 0xc0000dade0})
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:338 +0x7b
oh-my-posh/engine.(*Block).renderSegmentsText.func1(0x0)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:87 +0x65
created by oh-my-posh/engine.(*Block).renderSegmentsText
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:85 +0x9d
@Kyllingene check #1907, fix incoming.
Ok, thanks!
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.
Code of Conduct
What happened?
At random times, rendering one or more elements of the prompt results in errors of the following format:
"oh-my-posh fatal error rendering [segment] segment:runtime error: invalid memory address or nil pointer dereference"
The affected segment displays the text "error" when this event occurs. The affected segment can be something as trivial as the operating system logo or the last execution timer.
Version
Theme
night-owl, no modifications.
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Relevant log output