I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.

Note: You have to check the box - view Hidden Files to see these folders within File Explorer.

This solved it.

There must have been some weird corrupted cache issue at the heart of this.

I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log

[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []

I think it is related to this.

BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:

  • PowerShell
  • PowerShell Preview

I had upgraded PowerShell to the latest version 7 too.

$PSVersionTable yielded the following from the respective executables.

Executable Path Version
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 5.1.17763.1852
C:\Program Files\PowerShell\7\pwsh.exe 7.2.6

Maybe that combo hosed things

Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.

  • Then I realised had opened the Project folder in the explorer on the left of the IDE.
  • I had a subfolder that had a PS1 file within that.
  • It didn't have its own .vscode\settings.json
  • When I copied it down from the parent folder, suddenly everything worked again.

.vscode\settings.json just contained this:

{
}

Again this ended up being a one time solution. I ended up back at:

Shell activation failed to activate for cmd.exe

I posted this as a new ticket here

  • In the end I found this to be more of a display issue than anything else!
  • You can actually type cls then hit ENTER, to restore things to the status quo.
  • The Terminal section is black with no prompt to begin with. But you can type in it!!!
  • Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
Answer from JGFMK on Stack Overflow
🌐
GitHub
github.com › microsoft › vscode › issues › 179529
Shell integration failed to activate · Issue #179529 · microsoft/vscode
April 8, 2023 - Command line: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe '-noexit' '-command' 'try { . "c:\Users\ahmed\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\browser\media\shellIntegration.ps1" } catch {}'
Author   ahmedelmahi
Top answer
1 of 2
3

I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.

Note: You have to check the box - view Hidden Files to see these folders within File Explorer.

This solved it.

There must have been some weird corrupted cache issue at the heart of this.

I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log

[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []

I think it is related to this.

BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:

  • PowerShell
  • PowerShell Preview

I had upgraded PowerShell to the latest version 7 too.

$PSVersionTable yielded the following from the respective executables.

Executable Path Version
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 5.1.17763.1852
C:\Program Files\PowerShell\7\pwsh.exe 7.2.6

Maybe that combo hosed things

Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.

  • Then I realised had opened the Project folder in the explorer on the left of the IDE.
  • I had a subfolder that had a PS1 file within that.
  • It didn't have its own .vscode\settings.json
  • When I copied it down from the parent folder, suddenly everything worked again.

.vscode\settings.json just contained this:

{
}

Again this ended up being a one time solution. I ended up back at:

Shell activation failed to activate for cmd.exe

I posted this as a new ticket here

  • In the end I found this to be more of a display issue than anything else!
  • You can actually type cls then hit ENTER, to restore things to the status quo.
  • The Terminal section is black with no prompt to begin with. But you can type in it!!!
  • Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
2 of 2
2

Closing VSCode, verifying that powershell works, then reopening it worked for me.

Discussions

Shell integration injection failed to activate after installing PowerShell 7
Type: Bug Install PowerShell 7 Create new terminal session and select PowerShell The terminal crashes and closes after dumping a long repeating stack trace. VS Code then throws the following error: The terminal process "C:\Program Files\... More on github.com
🌐 github.com
8
July 15, 2025
windows - VS Code: "Shell Integration Failed To Activate" - Stack Overflow
When I hover on my VS Code terminal name (in the terminal's upper right corner named "Powershell"), it shows: shell integration failed to activate How to solve this error? I tried re- More on stackoverflow.com
🌐 stackoverflow.com
Python Debug Console: Shell integration failed to activate
Type: Bug Behaviour Expected vs. Actual Python Debug Console shows "Shell integration failed to activate" Steps to reproduce: Open a Python file Run command >Python: Debug Python File ... More on github.com
🌐 github.com
35
August 12, 2022
Shell integration failed to activate
Does this issue occur when all ... get the "Shell integration failed to activate" message in a tooltip. As you can see there is no Prompt message and somewhere for me to type on the command line.) ... Steps to Reproduce: I had tried adding a couple of PowerShell VSCode IDE Extensions ... More on github.com
🌐 github.com
2
October 17, 2022
🌐
Visual Studio Code
code.visualstudio.com › docs › terminal › shell-integration
Terminal Shell Integration
November 3, 2021 - # Output the executable's path first: code --locate-shell-integration-path bash # Add the result of the above to the source statement: [[ "$TERM_PROGRAM" == "vscode" ]] && . "/path/to/shell/integration/script.sh" When using shell integration, it has a "quality" associated with it that declares the capabilities of it. These qualities are determined by how the shell integration script behaves. None: No shell integration is active.
🌐
GitHub
github.com › microsoft › vscode › issues › 255940
Shell integration injection failed to activate after installing PowerShell 7 · Issue #255940 · microsoft/vscode
July 15, 2025 - Shell integration: Injection failed to activate · # Terminal Environment Changes ## Extension: vscode.git Enables the following features: git auth provider - `GIT_ASKPASS=c:\Users\[REDACTED]\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass.sh` - `VSCODE_GIT_ASKPASS_NODE=C:\Users\[REDACTED]\AppData\Local\Programs\Microsoft VS Code\Code.exe` - `VSCODE_GIT_ASKPASS_EXTRA_ARGS=` - `VSCODE_GIT_ASKPASS_MAIN=c:\Users\[REDACTED]\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js` - `VSCODE_GIT_IPC_HANDLE=\\.\pipe\vscode-git-5ac1cb24db-sock` The stack trace is too large paste here so I've added it to a gist: https://gist.github.com/ryanmichaeljames/d5e7c8de2ba6d983dd022f254beeebe2 ·
Author   ryanmichaeljames
🌐
GitHub
github.com › microsoft › vscode › issues › 158218
Python Debug Console: Shell integration failed to activate · Issue #158218 · microsoft/vscode
August 12, 2022 - Multiroot scenario, following user settings may not apply: languageServer: "Pylance" formatting • provider: "black" terminal • activateEnvironment: false
Author   danielniccoli
🌐
GitHub
github.com › microsoft › vscode › issues › 163830
Shell integration failed to activate · Issue #163830 · microsoft/vscode
October 17, 2022 - [2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host [2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args [] [2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args [] I believe this to be some sort of cache corruption and is related to issue 133542. I posted my findings here on Stack Overflow · I'm happy to spin up a Zoom if it helps. I sent an email to roblourens - so he just needs to reach out to me via email and I'll action that. Issue 163091 may also be related. ... In case seeing the environment vars within VSCode helps ...
Author   JGFMK
Find elsewhere
Top answer
1 of 2
1

Closing VSCode, verifying that powershell works, then reopening it worked for me.

2 of 2
0

I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.

Note: You have to check the box - view Hidden Files to see these folders within File Explorer.

This solved it.

There must have been some weird corrupted cache issue at the heart of this.

I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log

[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []

I think it is related to this.

BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:

  • PowerShell
  • PowerShell Preview

I had upgraded PowerShell to the latest version 7 too.

$PSVersionTable yielded the following from the respective executables.

Executable Path Version
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 5.1.17763.1852
C:\Program Files\PowerShell\7\pwsh.exe 7.2.6

Maybe that combo hosed things

Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.

  • Then I realised had opened the Project folder in the explorer on the left of the IDE.
  • I had a subfolder that had a PS1 file within that.
  • It didn't have its own .vscode\settings.json
  • When I copied it down from the parent folder, suddenly everything worked again.

.vscode\settings.json just contained this:

{
}

Again this ended up being a one time solution. I ended up back at:

Shell activation failed to activate for cmd.exe

I posted this as a new ticket here

  • In the end I found this to be more of a display issue than anything else!
  • You can actually type cls then hit ENTER, to restore things to the status quo.
  • The Terminal section is black with no prompt to begin with. But you can type in it!!!
  • Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
🌐
GitHub
github.com › microsoft › vscode › issues › 200231
Bash don't work inside VS Code, cannot type 'Shell integration failed to activate' · Issue #200231 · microsoft/vscode
December 7, 2023 - Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. ... My Bash shell is not working inside VS Code, I simply cannot type anything when I'm inside VS Code but I can when I open the ...
Author   3mper0r
🌐
Stack Overflow
stackoverflow.com › questions › 77661247 › what-does-it-mean-shell-integration-failed-to-activate-in-vscode
What does it mean "shell integration failed to activate" in vscode?
I have pasted "shell integration failed to activate" in chatgpt and it suggests a few solutions like "check node.js installation" "check environment variables" "restart vscode" etc. but none of these work and the problem is still there. Why is this happening, and how can this issue be resolved?
🌐
YouTube
youtube.com › watch
vs code shell integration failed to activate [FIXED] - YouTube
vs code shell integration failed to activate [FIXED]visual studio error code shell integration failed to activate [FIXED]
Published   September 22, 2022
🌐
GitHub
github.com › microsoft › vscode-remote-release › issues › 9150
Shell integration failed to activate (zsh) · Issue #9150 · microsoft/vscode-remote-release
October 30, 2023 - Type: Bug Shell integration failed to activate Extension version: 0.106.5 VS Code version: Code 1.83.1 (Universal) (f1b07bd25dfad64b0167beb15359ae573aecd2cc, 2023-10-10T23:46:55.789Z) OS version: D...
Author   tekumara
🌐
GitHub
github.com › cline › cline › wiki › Troubleshooting-‐-Shell-Integration-Unavailable
Troubleshooting ‐ Shell Integration Unavailable
Confirm the Change by typing Y and pressing Enter when prompted. Verify the Policy Change by running Get-ExecutionPolicy again to confirm the new setting. Restart VSCode and try the shell integration again.
Author   cline
🌐
Reddit
reddit.com › r/onlyaicoding › shell integration unavailable (cline)
r/OnlyAICoding on Reddit: Shell Integration unavailable (Cline)
December 21, 2024 -

I'm curious if anyone has managed to fix this error on Windows? On all supported shells, in edition to the Shell Unavailable error I also get an error that the terminal process failed to launch, and the current working directory, which is claims is my desktop, does not exist. Perhaps I should launch VSCode from the start menu and not the desktop shortcut? Ask this on the Cline Discord and nobody helps. I'm guessing most users are on Mac or something; I remember when Mac was laughed at for development.

Top answer
1 of 1
1
Resolving Cline Integration Issues in PowerShell For PowerShell, follow these Hints mentioned here: https://github.com/cline/cline/wiki/Troubleshooting-%E2%80%90-Shell-Integration-Unavailable#step-2-configure-vscode-to-use-the-correct-shell additionally i had to to the following: - Remove Conflicting Profile Scripts: Navigate to your PowerShell profile directory and delete any unnecessary or conflicting profile.ps1 files to prevent interference with Cline's functionality. - Set Execution Policy to RemoteSigned: Open each installed version of PowerShell on your system with administrative privileges. Usually Windows has at least 2 different PowerShell. All can be found by the Start Menu. In each session, execute the following command to allow the running of local scripts and those signed by a trusted publisher: > Set-ExecutionPolicy RemoteSigned -Scope CurrentUser This configuration permits the execution of necessary scripts while maintaining security. Verify the Execution Policy: > Get-ExecutionPolicy -Scope CurrentUser Ensure that the output is RemoteSigned. Restart PowerShell and Visual Studio Code: Close all instances of PowerShell and Visual Studio Code to apply the changes. Reopen Visual Studio Code and initiate a new PowerShell terminal session. By performing these steps, you align your PowerShell environment with Cline's requirements, facilitating proper shell integration and functionality. What really solved the issue, I couldn't figure out. I tried for several hours what was mentioned on their Github, but these steps finally solved my issue and it runs on VS Code under Windows.
🌐
GitHub
github.com › microsoft › vscode › issues › 181988
Shell integration failed to activate in VS code Ubuntu · Issue #181988 · microsoft/vscode
May 10, 2023 - Does this issue occur when all extensions are disabled?: Yes, and also with all extensions enabled too VS Code Version: 1.78 OS Version: Ubuntu 22.04.2 LTS I am getting this: bash Process ID (PID): 78677 Command line: /usr/bin/bash '--in...
Published   May 10, 2023
Author   octonawish-akcodes
🌐
GitHub
github.com › microsoft › vscode › issues › 200757
Shell integration failed to activate · Issue #200757 · microsoft/vscode
December 13, 2023 - C Kill (D Process ID (PID): 16368 Command line: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe no exit` '-command* "try (. "c:\Users\User\AppData\Local\Programs\Microsoft VS Code\resources\app\out\lvs\workbench\contrib\terminal\browser\media\shelllntegrati on.ps1") catch f Shell integration failed to activate n Reader Optimized Ln 11, Col 56 (51 selected) Spaces: 4 We have written the needed data into your clipboard because it was too large to send.
Author   oblason
🌐
GitHub
github.com › microsoft › vscode › issues › 205929
Shell integration failed to activate · Issue #205929 · microsoft/vscode
Command line: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe '-noexit' '-command' 'try { . "c:\Users\xxx\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\browser\media\shellIntegration.ps1" } catch {}'
🌐
GitHub
github.com › microsoft › vscode › issues › 168544
Shell integration failed to active · Issue #168544 · microsoft/vscode
Does this issue occur when all extensions are disabled?: Yes/No VS Code Version: 1.74.0 OS Version: windows 11 Steps to Reproduce: Shell integration failed to active
🌐
Reddit
reddit.com › r/roocline › what is the best workaround for "shell integration unavailable"?
r/roocline on Reddit: What is the best workaround for "Shell integration unavailable"?
January 19, 2025 -

This is what is literally stopping me from using Roo-Cline. On Windows, set the PowerShell security policy to remote signed, set the default profile to PowerShell, updated to the latest vsCode...

Before the AI executes a command, I get an error when it launches the terminal, or tries, and it is trying to use a cwd command to launch it in a folder that doesn't exist.

Using Gemini flash at the moment just to test whether it can execute or see terminal output.

Anybody have any other suggestions to try?