oh-my-posh causes SyntaxError: Unexpected non-whitespace character after JSON

Just did the troubleshooting and want some help mitigating. No game could get game info. I saw this line in the Heroic logs which told me nothing
(19:32:35) ERROR: [Legendary]: Error: Failed to parse install info for 98614687b212444c9ff0d42095f56cb3 with: SyntaxError: Unexpected non-whitespace character after JSON at position 880 (line 2 column 1)

at Module.$n (C:\Users\myusername\AppData\Local\Programs\heroic\resources\app.asar\build\main\main.js:114:2826)

at processTicksAndRejections (node:internal/process/task_queues:95:5)

at C:\Users\myusername\AppData\Local\Programs\heroic\resources\app.asar\build\main\main.js:184:4033

at WebContents.<anonymous> (node:electron/js2c/browser_init:2:83537)
(19:32:35) ERROR: [Legendary]: Error: Failed to parse install info for 98614687b212444c9ff0d42095f56cb3 with: SyntaxError: Unexpected non-whitespace character after JSON at position 880 (line 2 column 1)

at Module.$n (C:\Users\myusername\AppData\Local\Programs\heroic\resources\app.asar\build\main\main.js:114:2826)

at processTicksAndRejections (node:internal/process/task_queues:95:5)

at C:\Users\myusername\AppData\Local\Programs\heroic\resources\app.asar\build\main\main.js:184:4033

at WebContents.<anonymous> (node:electron/js2c/browser_init:2:83537)
However, in all the logs I also saw fastfetch dump my personal info over and over and over. Turns out Powershell was calling my profile at C:\Users\myusername\OneDrive\Documents\WindowsPowerShell, which in addition to fastfetch, included oh-my-posh --init --shell pwsh --config $themePath | Invoke-Expression I commented out this line and Heroic was immediately able to pull my info correctly. Is there a way to call Powershell bypassing the profile? Or to set up my profile so that it doesn't trigger when called by Heroic?
17 Replies
rival-black
rival-black5mo ago
post the whole log, not just the bits you think are relevant
protestant-coral
protestant-coralOP5mo ago
Sorry it's full of PII due to aforementioned fastfetch lol Let me redact
dependent-tan
dependent-tan5mo ago
I wonder if you can make that fastfetch or that oh-my-posh to not output anything, that might be easier maybe? or maybe only call that line if one of the heroic env variables is not present
protestant-coral
protestant-coralOP5mo ago
wait actually i forgot i uploaded a redacted version already. dummy https://0x0.st/8sD5.log https://0x0.st/8sDk.log at first I thought it was y'all scraping my PC and I was freakin out fastfetch is running on lines marked [an absurd amount of personal info redacted] so y'all are starting a new pwsh process there
protestant-coral
protestant-coralOP5mo ago
I think there's a way to pass a -NonInteractive flag which I could detect. Per this StackOverflow thread https://stackoverflow.com/questions/9738535/powershell-test-for-noninteractive-mode
Stack Overflow
Powershell test for noninteractive mode
I have a script that may be run manually or may be run by a scheduled task. I need to programmatically determine if I'm running in -noninteractive mode (which is set when run via scheduled task) or
protestant-coral
protestant-coralOP5mo ago
Although I'll admit it's out of my depth genuinely surprised this hasn't cropped up before
dependent-tan
dependent-tan5mo ago
looks like there's a -NoProfile command that can be passed to powershell
protestant-coral
protestant-coralOP5mo ago
or that
dependent-tan
dependent-tan5mo ago
most users don't really know what powershell is, let alone adding a profile
protestant-coral
protestant-coralOP5mo ago
lol fair so y'all can fix it somewhat easily?
dependent-tan
dependent-tan5mo ago
I don't really use windows at all, so I don't know, maybe it's a matter of adding that -NoProfile when calling powershell but I have no way of testing, I'll share this with the rest in case someone knows how to handle that
protestant-coral
protestant-coralOP5mo ago
Sounds good. I'll just leave my profile commented for now. I'm happy to run tests in the future if it would help. Will this be an Issue on GitHub? I could track it there
dependent-tan
dependent-tan5mo ago
sure, it will make it easier to find, this can get burried with new support threads added every day
protestant-coral
protestant-coralOP5mo ago
i had a feeling You want me to submit?
dependent-tan
dependent-tan5mo ago
sure!
protestant-coral
protestant-coralOP5mo ago
on it, boss
protestant-coral
protestant-coralOP5mo ago
GitHub
Heroic calls PowerShell, which uses $PROFILE, which can contain com...
Describe the bug TL;DR: Heroic is using PowerShell on Windows, which calls a user's $PROFILE, and some things (like oh-my-posh) can interfere with Heroic. Please use -NoProfile to prevent this....

Did you find this page helpful?