Skip to content

VS Code Python extension injects incorrect start up script oh-my-posh variables with shell integration #25280

@iibadshah

Description

@iibadshah

Type: Bug

Behaviour

I'm using oh-my-posh to display extra info in the VS Code integrated terminal for PowerShell (v7) and Git Bash.

When using Windows Terminal I can see that the theme changes are present, but in the VS Code integrated terminal the changes are not reflected for Git Bash (there are no issues with PowerShell): the previous theme (which was a downloaded local JSON) is still present. Moreover, the previous theme had a segment on the right saying CONFIG ERROR. Additionally, this is only the case when opening a project folder, as VS Code instances outside of a project don't have the issue. I am using poetry and working on a python project, if this is of any importance.

Steps to reproduce:

  1. Open VS Code Folder.
  2. The Folder should be to a python project (I have tested that the issue is present in projects managed by pipenv or poetry, but NOT when VS Code is opened outside of a python folder).
  3. Start an integrated Terminal.
  4. Click 'Launch Profile' to start a Git Bash terminal (since PowerShell is my default).

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2025-07-12 13:44:55.345 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-07-12 13:44:55.345 [info] Native locator: Refresh started
2025-07-12 13:44:57.014 [info] > pyenv which python
2025-07-12 13:44:57.014 [info] cwd: .
2025-07-12 13:45:01.444 [info] Poetry environment manager found at: c:\users\buzzb\.local\bin\poetry.exe
2025-07-12 13:45:01.456 [info] Native locator: Refresh finished in 6473 ms
2025-07-12 13:45:01.466 [info] Python interpreter path: ~\AppData\Local\pypoetry\Cache\virtualenvs\onmass-1xIxFAGP-py3.13\Scripts\python.exe
2025-07-12 13:45:02.212 [info] > & ~/AppData/Local/pypoetry/Cache/virtualenvs/onmass-1xIxFAGP-py3.13/Scripts/Activate.ps1 ; echo 'e8b39361-0157-4923-80e1-22d70d46dee6' ; python ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-12 13:45:02.214 [info] shell: powershellCore
2025-07-12 13:45:03.900 [info] > C:\Program Files\Python312\python.exe ~/.vscode/extensions/ms-python.python-2025.10.0-win32-x64/python_files/printEnvVariables.py
2025-07-12 13:45:03.900 [info] shell: powershellCore
2025-07-12 13:45:04.090 [info] Starting Pylance language server.
2025-07-12 13:45:05.894 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to False {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Prepending environment variable PATH in collection with c:\Users\BuzzB\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell;C:\Users\BuzzB\AppData\Local\pypoetry\Cache\virtualenvs\onmass-1xIxFAGP-py3.13/Scripts;C:\Program Files\PowerShell\7; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable PATHEXT in collection to .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.CPL {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable POSH_SESSION_ID in collection to 84aabf66-d131-4773-b808-9e45d10b3b64 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable POSH_SHELL in collection to pwsh {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable POSH_SHELL_VERSION in collection to 7.5.2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable POSH_THEME in collection to C:\Users\BuzzB\AppData\Local\Programs\oh-my-posh\themes\atomic.omp.json {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable POWERLINE_COMMAND in collection to oh-my-posh {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable PSMODULEPATH in collection to C:\Users\BuzzB\OneDrive\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 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable PYENV_VIRTUALENV_DISABLE_PROMPT in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable PYTHONIOENCODING in collection to utf-8 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable PYTHONUNBUFFERED in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Users\BuzzB\AppData\Local\pypoetry\Cache\virtualenvs\onmass-1xIxFAGP-py3.13 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable VIRTUAL_ENV_DISABLE_PROMPT in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.894 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to onmass-py3.13 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:05.896 [info] Send text to terminal: & "C:/Program Files/Python312/python.exe" c:\Users\BuzzB\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\printEnvVariablesToFile.py c:\Users\BuzzB\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell\envVars.txt
2025-07-12 13:45:10.351 [info] Shell integration status changed, can confirm it's working.
2025-07-12 13:45:10.353 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to False {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Prepending environment variable PATH in collection with c:\Users\BuzzB\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell;C:\Users\BuzzB\AppData\Local\pypoetry\Cache\virtualenvs\onmass-1xIxFAGP-py3.13/Scripts;C:\Program Files\PowerShell\7; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable PATHEXT in collection to .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.CPL {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable POSH_SESSION_ID in collection to 84aabf66-d131-4773-b808-9e45d10b3b64 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable POSH_SHELL in collection to pwsh {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable POSH_SHELL_VERSION in collection to 7.5.2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable POSH_THEME in collection to C:\Users\BuzzB\AppData\Local\Programs\oh-my-posh\themes\atomic.omp.json {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable POWERLINE_COMMAND in collection to oh-my-posh {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable PSMODULEPATH in collection to C:\Users\BuzzB\OneDrive\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 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable PYENV_VIRTUALENV_DISABLE_PROMPT in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable PYTHONIOENCODING in collection to utf-8 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable PYTHONUNBUFFERED in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable VIRTUAL_ENV in collection to C:\Users\BuzzB\AppData\Local\pypoetry\Cache\virtualenvs\onmass-1xIxFAGP-py3.13 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable VIRTUAL_ENV_DISABLE_PROMPT in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2025-07-12 13:45:10.353 [info] Setting environment variable VIRTUAL_ENV_PROMPT in collection to onmass-py3.13 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}

Additional degugging

Please see the Stack Overflow question for this issue:
https://stackoverflow.com/q/79699240/10771401

This is the issue opened at oh-my-posh:
JanDeDobbeleer/oh-my-posh#6594

The task

I'm using oh-my-posh to display extra info in the terminal for PowerShell (v7) and Git Bash.

The problem

When using Windows Terminal I can see that the theme changes are present, but in the VS Code integrated terminal the changes are not reflected for Git Bash (there are no issues with PowerShell): the previous theme (which was a downloaded local JSON) is still present. Moreover, the previous theme had a segment on the right saying CONFIG ERROR. Additionally, this is only the case when opening a project folder, as VS Code instances outside of a project don't have the issue. I am using poetry and working on a python project, if this is of any importance.

Debug

Here is my current .bashrc:

eval "$(oh-my-posh init bash --config 'https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/atomic.omp.json')"

Here is the .bash_profile:

test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc

Here is the head (up to the ERROR statement) of the oh-my-posh debug output (note that although a (Git) Bash terminal is selected in VS Code it thinks it is PowerShell, which helps to explain the mangled paths):

Version: 26.14.3

Shell: pwsh (7.5.2)

Prompt:

 BB   test   main ≡    CONFIG ERROR                                                                                              in pwsh at 11:32:18

Segments:

ConsoleTitle(true) -   0 ms
Session(true)      -   0 ms
Path(true)         -   1 ms
Git(true)          -  27 ms
Root(true)         -   0 ms
Status(true)       -   1 ms
Node(false)        -   0 ms
Go(false)          -   0 ms
Python(true)       -   0 ms
Shell(true)        -   0 ms
Time(true)         -   0 ms

Run duration: 31.6562ms

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

Config path: C:\Users\BB\AppData\Local\Programs\oh-my-posh   hemestomic.omp.json

Logs:

[DEBUG] 11:32:18.499 debug.go:35 → logging enabled, raw mode: false
[DEBUG] 11:32:18.499 load.go:filePath:102 → config set using POSH_THEME: C:\Users\BB\AppData\Local\Programs\oh-my-posh       hemestomic.omp.json
[TRACE] 11:32:18.499 load.go:filePath() - 0s
[ERROR] 11:32:18.500 load.go:readConfig:156 → open C:\Users\BB\AppData\Local\Programs\oh-my-posh     hemestomic.omp.json: The filename, directory name, or volume label syntax is incorrect.

In VS Code clicking the 'Show Environment Contributions' opens a markdown that points where the issue likely is (note only the python extension variables are shown):

# Terminal Environment Changes

## Extension: ms-python.python

Activated environment for `~\AppData\Local\pypoetry\Cache\virtualenvs\test-1xIxFAGP-py3.13\Scripts\python.exe`

- `PYTHON_BASIC_REPL=1`
- `CONDA_PROMPT_MODIFIER=False`
- `PATH=c:\Users\BB\.vscode\extensions\ms-python.python-2025.10.0-win32-x64\python_files\deactivate\powershell;C:\Users\BB\AppData\Local\pypoetry\Cache\virtualenvs\test-1xIxFAGP-py3.13/Scripts;C:\Program Files\PowerShell\7;${env:PATH}`
- `PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.CPL`
- `POSH_SESSION_ID=96cd2964-5ed9-4dac-8f2e-9b90fdc4bfd8`
- `POSH_SHELL=pwsh`
- `POSH_SHELL_VERSION=7.5.2`
- `POSH_THEME=C:\Users\BB\AppData\Local\Programs\oh-my-posh\themes\atomic.omp.json`
- `POWERLINE_COMMAND=oh-my-posh`
- `PSMODULEPATH=C:\Users\BB\OneDrive\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`
- `PYENV_VIRTUALENV_DISABLE_PROMPT=1`
- `PYTHONIOENCODING=utf-8`
- `PYTHONUNBUFFERED=1`
- `VIRTUAL_ENV=C:\Users\BB\AppData\Local\pypoetry\Cache\virtualenvs\test-1xIxFAGP-py3.13`
- `VIRTUAL_ENV_DISABLE_PROMPT=1`
- `VIRTUAL_ENV_PROMPT=test-py3.13`

In the location C:\Users\BB\AppData\Local\oh-my-posh, there is a Shell Script which contains oh-my-posh variables (note only the top of the file is listed below):

export POSH_THEME=$'C:\\Users\\BB\\AppData\\Local\\Programs\\oh-my-posh\\themes\\atomic.omp.json'
export POSH_SHELL='bash'
export POSH_SHELL_VERSION=$BASH_VERSION
export POWERLINE_COMMAND='oh-my-posh'
export CONDA_PROMPT_MODIFIER=false
export OSTYPE=$OSTYPE

# disable all known python virtual environment prompts
export VIRTUAL_ENV_DISABLE_PROMPT=1
export PYENV_VIRTUALENV_DISABLE_PROMPT=1

# global variables
_omp_start_time=''
_omp_stack_count=0
_omp_execution_time=-1
_omp_no_status=true
_omp_status=0
_omp_pipestatus=0
_omp_executable=$'C:/Users/BB/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe'

export POSH_SESSION_ID=$("$_omp_executable" get uuid)

# switches to enable/disable features
_omp_cursor_positioning=0
_omp_ftcs_marks=0

Lastly, changing the VS Code settings.json option:
"terminal.integrated.shellIntegration.enabled" from the default true to false resolves the problem, but at the expense of loosing the additional features that it provides. Note that I have installed and set in VS Code settings.json a Monospaced Nerd Font.

Conclusions

It seems that the VS Code python extension is injecting oh-my-posh variables in the shell; why on earth, I don't know. But critically they are wrong, since it is a bash shell not pwsh.

  1. What is at fault, is it oh-my-posh, VS Code, poetry, or something else?
  2. How do I fix the issue? (I'm not interested in simply disabling shell integrations alltogether).

Extension version: 2025.10.0
VS Code version: Code 1.102.0 (cb0c47c0cfaad0757385834bd89d410c78a856c0, 2025-07-09T22:10:34.600Z)
OS version: Windows_NT x64 10.0.26100
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.5
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
code-spell-checker str 4.0.47
copilot Git 1.342.0
copilot-chat Git 0.29.0
datawrangler ms- 1.22.0
debugpy ms- 2025.10.0
docker doc 0.12.0
even-better-toml tam 0.21.2
intellicode-api-usage-examples Vis 0.2.9
js-debug ms- 1.102.0
js-debug-companion ms- 1.1.3
jupyter ms- 2025.6.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
material-icon-theme PKi 5.24.0
powershell ms- 2025.2.0
python ms- 2025.10.0
r REd 2.8.6
r-syntax REd 0.1.3
rainbow-csv mec 3.20.0
remote-containers ms- 0.422.0
remote-wsl ms- 0.99.0
ruff cha 2025.24.0
theme-dracula dra 2.25.1
vscode-containers ms- 2.0.3
vscode-cython ktn 1.0.3
vscode-docker ms- 2.0.0
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-markdownlint Dav 0.60.0
vscode-pylance ms- 2025.6.2
vscode-sanddance msr 4.2.0
vscode-xml red 0.29.0
vscodeintellicode Vis 1.3.2
System Info
Item Value
CPUs Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz (8 x 2304)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.78GB (48.20GB free)
Process Argv --crash-reporter-id 6c9c76d3-84d3-440d-85bb-0171f3f92c8a
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
2e7ec940:31000449
cppperfnew:31000557
dwnewjupyter:31046869
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
hdaa2157:31222309
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
9d2cg352:31346308
convertlamdat:31329272
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335815
nes-diff-11:31337487
63221493:31336333
yijiwantestdri0626-t:31336930
ji9b5146:31342393

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions