Skip to main content
Support

Terminal execution exceptions

Introduction

Terminal execution depends heavily on your environment and configuration. VS Code and JetBrains IDEs have certain limitations and compatibility issues with terminals on different operating systems. As a result, you may encounter problems such as being unable to properly invoke the terminal to execute commands or being unable to obtain execution output when using Qoder CN Agent mode.

VSCode

Common troubleshooting methods

The Qoder CN VSCode plugin relies on the VSCode Shell integration API to invoke the terminal to run commands and read their output. This API is a new feature provided in VSCode version 1.93 and currently only supports the following shell types. You need to ensure that your VSCode version is greater than 1.93 and that the default terminal is configured to one of the following types:
  • Linux/macOS: bash, fish, pwsh, zsh
  • Windows: Git Bash, pwsh
If you encounter a terminal execution exception, try the following methods in order:

Method 1: Upgrade VSCode

Check your VSCode version and ensure it is 1.93 or later:
  1. Open VSCode;
  2. Press Cmd + Shift + P (Mac) or Ctrl + Shift + P (Windows/Linux);
  3. Type Code: Check for Updates, then select it;
  4. After the update completes, restart VSCode.

Method 2: Configure a VSCode-supported Shell

  1. Open VSCode;
  2. Press Cmd + Shift + P (Mac) or Ctrl + Shift + P (Windows/Linux);
  3. Type Terminal: Select Default Profile, then select it;
  4. Choose a supported Shell:
  • Linux/macOS: bash, fish, pwsh, zsh
  • Windows: Git Bash, pwsh
  1. Fully exit VSCode, then reopen it.

Method 3: Manually install Shell integration

If you still encounter issues after trying the troubleshooting steps above, you can try manually installing Shell integration. For example, if you use zsh:
  1. Add the following line to your ~/.zshrc file:
    [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"
    
  2. Save the file;
  3. Fully exit VSCode, then reopen it. If you use Bash (~/.bashrc):
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path bash)"
If you use PowerShell ($Profile):
if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }
If you use Fish (~/.config/fish/config.fish):
string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish)
If you use another shell type, refer to the documentation: Manual installation of Shell integration.

Still having issues?

If you have tried the methods above and still occasionally encounter situations where you cannot obtain terminal output, try closing the terminal window that cannot obtain output (click the Stop Terminal button), then run the command again. This refreshes the terminal connection and is likely to solve the problem.

Windows troubleshooting methods

If you are using Windows and still encounter issues after trying the steps above, you can use the following methods:

Git Bash

You can try using Git Bash. Git Bash provides a Unix-like command-line experience on Windows. To use Git Bash, you need to:
  1. Download and run the Git for Windows installer from https://git-scm.com/downloads/win;
  2. Exit and reopen VSCode;
  3. Press Ctrl + Shift + P to open the command palette;
  4. Type Terminal: Select Default Profile, then select it;
  5. Select "Git Bash".

PowerShell

If you still want to use PowerShell, make sure you are using an updated version (at least v7+).
  • Check your current PowerShell version by running: $PSVersionTable.PSVersion
  • If your version is lower than 7, update PowerShell.
By default, PowerShell restricts script execution for security reasons. You may also need to adjust the PowerShell execution policy:
  1. Open PowerShell as an administrator: press Win + X and select "Windows PowerShell (Administrator)" or "Windows Terminal (Administrator)";
  2. Check the current execution policy by running:
    Get-ExecutionPolicy
    
  • If the output is already RemoteSigned, Unrestricted, or Bypass, you may not need to change the execution policy. These policies should allow Shell integration to work properly;
  • If the output is Restricted or AllSigned, you may need to change the policy to enable Shell integration.
  1. Change the execution policy by running:
    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    
    This sets the RemoteSigned policy only for the current user, which is safer than a system-wide change.
  2. Confirm the change: type Y at the prompt and press Enter;
  3. Verify the policy change: run Get-ExecutionPolicy again to confirm the new setting;
  4. Restart VSCode and try Shell integration again.

WSL

If you use WSL, try adding . "$(code --locate-shell-integration-path bash)" to your ~/.bashrc, then restart and try again.

Other exceptional situations

Terminal output exceptions

If you see abnormal output with rectangles, lines, escape sequences, or control characters, this may be related to terminal customization tools. Common culprits include: Powerlevel10k (a zsh theme that adds visual elements to the prompt), Oh My Zsh, Fish shell themes, etc. How to troubleshoot:
  1. Temporarily disable these tools in your Shell configuration file (for example, ~/.zshrc for Zsh);
  2. If the problem is resolved, gradually re-enable features to identify the conflicting tool.
For example, if you use Powerlevel10k in Zsh, you can disable it by commenting out the relevant lines in your ~/.zshrc file:
# 注释掉 Powerlevel10k 的源代码行
# source /path/to/powerlevel10k/powerlevel10k.zsh-theme
If disabling these customizations solves the problem, you may need to find an alternative configuration that is compatible with the VSCode Shell integration feature.

Jetbrains IDEs

The new Beta terminal is available in the new UI starting from IDE version 2024.1. The Qoder CN JetBrains plugin does not currently support the new terminal mode. You can disable the new terminal in the following ways: Method 1: In Settings or Preferences, open Tools - Terminal - Enable New Terminal and uncheck the new terminal option; Method 2: In the Terminal window title, click the icon and uncheck Enable New Terminal.

Contact us

If the solutions provided in this document still do not resolve your issue, you can contact us.
Guides
Tutorials
  • Coding with Qoder CN
Developer Reference