Repository navigation
.env values cached in terminal env across reload/quit; only "Clear Workspace Cache" flushes them (regression of #25805?) #25975
Description
Type: Bug
Behaviour
Editing or removing variables in the workspace .env file does not propagate to integrated terminals. The previously-loaded values
persist in process.env of every newly-spawned terminal until the workspace's cached env is explicitly cleared via Python:
Clear Workspace Cache and Reload Window.
This looks like a regression of (or follow-up to) #25805, which was closed but which I'm still reproducing on
ms-python.python@2026.4.0. Note: my repro covers changed values, not only removed ones — both stick.
Steps to reproduce:
-
Workspace with
.env:
DATABASE_URL=postgresql://old-host:5432/db -
Open the integrated terminal:
$ echo $DATABASE_URL
postgresql://old-host:5432/db -
Edit
.env→
DATABASE_URL=postgresql://new-host:5433/db
Save the file. -
Close all terminals.
Cmd+Qto fully quit VS Code. Reopen the workspace. -
New terminal still reports the old value:
$ echo $DATABASE_URL
postgresql://old-host:5432/db -
Run
> Python: Clear Workspace Cache and Reload Window. New terminal now reports the new value.
The cached env survives:
- Closing/reopening terminals
Developer: Reload Window- Full
Cmd+Qand relaunch - Machine reboot.
Expected behavior
A new terminal should pick up the current contents of .env — at minimum on workspace reopen, ideally on file save (with a
debounce / "relaunch terminal?" prompt as #25805 originally suggested).
Workaround
Setting workspace "python.envFile": "" disables the loader. Fine for projects where .env is consumed by Node/dotenv at runtime,
but not viable for actual Python projects.
Environment
- VS Code: 1.121.0 (commit f6cfa2ea2403534de03f069bdf160d06451ed282, arm64)
ms-python.python: 2026.4.0ms-python.vscode-pylance: 2026.2.1ms-python.vscode-python-envs: 1.30.0ms-python.debugpy: 2026.6.0- macOS Darwin 25.5.0 (arm64), zsh
- Project: Next.js / Node (
.envconsumed bydotenvat runtime)
Related
- Removed env vars from .env file don't leave the environment #25805 (closed) — same root cause for removed variables; this report shows it also affects changed variables and persists
across full quit/relaunch.
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
XXX
Extension version: 2026.4.0
VS Code version: Code 1.121.0 (f6cfa2ea2403534de03f069bdf160d06451ed282, 2026-05-19T11:51:53+02:00)
OS version: Darwin arm64 25.5.0
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.14.3
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
- Value of the
python.languageServersetting: Default
User Settings
envFile: "<placeholder>"
languageServer: "Pylance"
terminal
• activateEnvironment: false
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| app-studio-remote-access | SAP | 4.1.0 |
| app-studio-toolkit | SAP | 2.8.0 |
| bun-vscode | ove | 0.0.32 |
| claude-code | Ant | 2.1.145 |
| claude-dev | sao | 3.84.0 |
| cmake-tools | ms- | 1.23.52 |
| code-runner | for | 0.12.2 |
| code-snippet-tool | SAP | 2.0.4 |
| colab | goo | 0.8.1 |
| copilot-chat | Git | 0.49.0 |
| cpp-devtools | ms- | 0.5.13 |
| cpptools | ms- | 1.32.2 |
| cpptools-extension-pack | ms- | 1.5.1 |
| cpptools-themes | ms- | 2.0.0 |
| dart-code | Dar | 3.134.0 |
| debugpy | ms- | 2026.6.0 |
| docker | doc | 0.18.0 |
| EditorConfig | Edi | 0.18.2 |
| errorlens | use | 3.28.0 |
| es7-react-js-snippets | dsz | 4.4.3 |
| esbuild-problem-matchers | con | 0.0.3 |
| explorer | vit | 1.50.4 |
| fabric8-analytics | red | 0.10.2 |
| flutter | Dar | 3.134.0 |
| gitlens | eam | 17.12.2 |
| go | gol | 0.52.2 |
| hana-database-explorer | SAP | 1.37.0 |
| Handlebars | and | 0.4.1 |
| java | red | 1.54.0 |
| js-debug | ms- | 1.117.0 |
| js-debug-companion | ms- | 1.1.3 |
| jsts-chat-features | Typ | 0.0.2 |
| jupyter | ms- | 2025.9.1 |
| jupyter-keymap | ms- | 1.1.2 |
| jupyter-renderers | ms- | 1.3.0 |
| LiveServer | rit | 5.7.10 |
| makefile-tools | ms- | 0.12.17 |
| markdown-mermaid | bie | 1.32.1 |
| material-icon-theme | PKi | 5.35.0 |
| migrate-java-to-azure | vsc | 1.19.2 |
| mta-resource-generator | MTA | 0.0.1 |
| ng-template | Ang | 21.2.4 |
| npm-intellisense | chr | 1.4.5 |
| opencode | sst | 0.0.13 |
| oracle-java | Ora | 25.1.0 |
| tom | 1.2.2 | |
| prettier-vscode | esb | 12.4.0 |
| prettify-json | moh | 0.0.3 |
| pretty-ts-errors | Yoa | 0.8.7 |
| prisma | Pri | 31.11.0 |
| python | ms- | 2026.4.0 |
| quicktype | qui | 23.0.170 |
| rainbow-csv | mec | 3.24.1 |
| remote-containers | ms- | 0.459.0 |
| remote-explorer | ms- | 0.5.0 |
| remote-server | ms- | 1.5.3 |
| remote-ssh | ms- | 0.123.0 |
| remote-ssh-edit | ms- | 0.87.0 |
| remote-wsl | ms- | 0.104.3 |
| rest-client | hum | 0.25.1 |
| sap-guided-answers-extension | SAP | 1.32.20 |
| sap-hana-driver-for-sqltools | SAP | 0.2.1 |
| sap-ux-annotation-modeler-extension | SAP | 1.24.0 |
| sap-ux-application-modeler-extension | SAP | 1.24.0 |
| sap-ux-fiori-tools-extension-pack | SAP | 1.24.0 |
| sap-ux-help-extension | SAP | 1.24.0 |
| sap-ux-sap-systems-ext | SAP | 0.5.2 |
| sap-ux-service-modeler-extension | SAP | 1.24.0 |
| service-catalog | SAP | 1.4.0 |
| sonarlint-vscode | Son | 5.2.3 |
| sqlite-viewer | qwt | 25.12.2 |
| sqltools | mtx | 0.28.5 |
| test-adapter-converter | ms- | 0.2.1 |
| uuid-generator | net | 0.0.5 |
| volar | Vue | 3.3.1 |
| vs-code-prettier-eslint | rve | 6.0.0 |
| vscode-cds | SAP | 9.9.0 |
| vscode-containers | ms- | 2.4.4 |
| vscode-coverage-gutters | rya | 2.14.0 |
| vscode-docker | ms- | 2.0.0 |
| vscode-edge-devtools | ms- | 2.1.10 |
| vscode-edit-csv | jan | 0.11.9 |
| vscode-eslint | dba | 3.0.24 |
| vscode-gardener-tools | gar | 0.13.0 |
| vscode-github-actions | git | 0.31.5 |
| vscode-gradle | vsc | 3.17.3 |
| vscode-java-debug | vsc | 0.59.0 |
| vscode-java-dependency | vsc | 0.27.4 |
| vscode-java-pack | vsc | 0.31.0 |
| vscode-java-test | vsc | 0.45.0 |
| vscode-java-upgrade | vsc | 2.1.2 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-jupyter-cell-tags | ms- | 0.1.9 |
| vscode-jupyter-slideshow | ms- | 0.1.6 |
| vscode-kubernetes-tools | ms- | 1.3.29 |
| vscode-lombok | vsc | 1.1.1 |
| vscode-maven | vsc | 0.45.3 |
| vscode-mdx | uni | 1.8.17 |
| vscode-pgsql | ms- | 1.22.1 |
| vscode-pull-request-github | Git | 0.146.0 |
| vscode-pylance | ms- | 2026.2.1 |
| vscode-python-envs | ms- | 1.30.0 |
| vscode-qunit-snippets | sha | 0.2.0 |
| vscode-remote-extensionpack | ms- | 0.26.0 |
| vscode-sqlite3-editor | yy0 | 1.0.212 |
| vscode-tailwindcss | bra | 0.14.29 |
| vscode-thunder-client | ran | 2.40.12 |
| vscode-wing-cds-editor-vsc | SAP | 25.10.8 |
| vscode-xml | red | 0.29.2 |
| vscode-yaml | red | 1.23.0 |
| workspace-default-settings | dan | 0.0.7 |
| xml-toolkit | SAP | 1.2.1 |
| yeoman-ui | SAP | 1.23.0 |
System Info
| Item | Value |
|---|---|
| CPUs | Apple M3 Pro (12 x 2400) |
| GPU Status | 2d_canvas: enabled GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M3 Pro, Version 26.5 (Build 25F71))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.5 ACTIVE Machine model name: Mac Machine model version: 15.7 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: enabled_on trees_in_viz: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | 4, 4, 4 |
| Memory (System) | 18.00GB (0.09GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Activity