Skip to content

AI bash tool fails with Exit Code -1 in WSL, while manual terminal commands work #9514

Description

@NagaokaTaishi

Before opening, please confirm:

Operating System

Windows 11 + WSL2 Ubuntu

Kiro Version

0.12.333

Bug Description

After updating to Kiro IDE 0.12.333, terminal command execution from the AI chat/bash tool started failing consistently in a WSL environment.

The integrated terminal itself works correctly when commands are typed manually, but commands executed by Kiro's AI tool fail with Exit Code: -1. The command output is not captured properly; only the shell prompt appears.

Environment:

  • OS: Windows 11 + WSL2 Ubuntu
  • Shell: /bin/bash
  • bash path: /usr/bin/bash
  • Project path: ~/project
  • Remote status: WSL: Ubuntu

What works:
Manual commands in the Kiro integrated terminal work correctly.

Examples:

pwd
# ~/project

which bash
# /usr/bin/bash

ls -l /bin/bash
# /bin/bash exists

bash -lc 'echo KIRO_TERMINAL_OK'
# KIRO_TERMINAL_OK

Shell integration also appears to be enabled:

echo "$TERM_PROGRAM"
# kiro

echo "$VSCODE_SHELL_INTEGRATION"
# 1

declare -p PROMPT_COMMAND
# declare -- PROMPT_COMMAND="__vsc_prompt_cmd"

What fails:
When the AI chat tries to execute commands using the bash tool, all commands fail with Exit Code: -1.

Examples of failed commands:

git status
whoami
ls
pwd

The output only shows the shell prompt instead of the actual command output.

Expected behavior:
The AI bash tool should execute commands in the active WSL terminal and capture stdout/stderr correctly, the same as manual execution in the integrated terminal.

Actual behavior:
The AI bash tool fails with Exit Code: -1 and does not capture the command output, even though the integrated terminal itself is working.

Troubleshooting already attempted:

  • Restarted Kiro
  • Reloaded Window
  • Killed all terminals and opened a new terminal
  • Recreated ~/.kiro-server
  • Verified bash exists and works
  • Verified Shell Integration is enabled
  • Removed a local alias that was shadowing the WSL Kiro CLI
  • Confirmed kiro --locate-shell-integration-path bash returns a valid shell integration path
  • Downgraded Kiro

Result:
After downgrading from Kiro IDE 0.12.333 to 0.12.318, the AI bash tool started working again. git status executed successfully from the AI chat.

This suggests the issue is likely a regression in Kiro IDE 0.12.333 related to AI bash tool execution or WSL terminal output capture.

Steps to Reproduce

  1. Install Kiro IDE 0.12.333 on Windows.
  2. Open a project inside WSL2 Ubuntu using WSL: Ubuntu.
  3. Confirm that the integrated terminal works manually.
  4. In the AI chat, ask Kiro to run a simple command such as:
git status

or

pwd
  1. Observe that the AI bash tool fails with Exit Code: -1 and does not capture the command output.

Expected Behavior

The AI bash tool should execute commands in the active WSL terminal and correctly capture stdout, stderr, and the exit code.

For example, when asking the AI chat to run:

git status

Kiro should return the normal git status output, the same as when the command is run manually in the integrated terminal.

Conversation ID

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions