KIRO-IDE command execution bug TY=not a tty
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues
Operating System
linux
Kiro Version
0.8.135
Bug Description
execute_bash tool outputs 'TY=not a tty' causing command failures"
This is misleading KIRO-IDE and all the command executed automatically by KRIO-IDE have this issues. It is consuming my credit without positive output.
--------actual output----- Docker Compose version v5.0.0 TY=not a ttyilesh@nilesh-Inspiron-14-7435-2-in-1: ~/kiro/cost-reportnilesh@nilesh-Inspiron-14-7435-2-in-1:~/kiro/cost-report --------Interpreted by KIRO-IDE------- I see the issue - all commands are returning Exit Code: -1 even though they're working. This appears to be a terminal/TTY issue. Let me check if the containers are actually running:
My all other command in actual terminal work fine. Even KIRO-CLI works fine. But KIRO-IDE is not.
Steps to Reproduce
docker compose version Docker Compose version v5.0.0 TY=not a ttyilesh@nilesh-Inspiron-14-7435-2-in-1: ~/kiro/cost-reportnilesh@nilesh-Inspiron-14-7435-2-in-1:~/kiro/cost-report I see the issue - all commands are returning Exit Code: -1 even though they're working. This appears to be a terminal/TTY issue. Let me check if the containers are actually running:
Expected Behavior
docker compose version Docker Compose version v5.0.0 nilesh@nilesh-Inspiron-14-7435-2-in-1: ~/kiro/cost-reportnilesh@nilesh-Inspiron-14-7435-2-in-1:~/kiro/cost-report I see the issue - all commands are returning Exit Code: -1 even though they're working. This appears to be a terminal/TTY issue. Let me check if the containers are actually running:
Conversation ID
fff05874-2b1a-42df-9370-455c32db1a1d 165b7f17-f1f8-47af-a503-e715c0a314ac 57a544bb-5b42-4897-824e-75e3a622acdf edb035b2-a78f-4699-82ca-70dd88ac1099 bcca0050-3596-493c-8810-c3de349883a1
Additional Context
No response
🤖 Potential Duplicate Detected
This issue appears to be similar to:
- #4833: Terminal tool corrupts output and reports incorrect exit codes when shell outputs OSC escape sequences (95% similar)
- #4321: Kiro doesn't respect the current terminal shell (85% similar)
- #4132: Kiro keeps displaying 'working' after executing the command (85% similar)
- #4011: Kiro chat agent cannot read output from commands (85% similar)
- #3818: Command execution stop (85% similar)
- #4009: Command execution appears to succeed in UI but fails silently without recording in execution history (82% similar)
What happens next?
- ⏰ This issue will be automatically closed in 3 days
- 🏷️ Remove the
duplicatelabel if this is NOT a duplicate - 💬 Comment on the original issue if you have additional information
Why is this marked as duplicate? Both report terminal/command execution issues with corrupted output and incorrect exit codes. Issue #4833 specifically mentions 'Terminal tool corrupts output and reports incorrect exit codes when shell outputs OSC escape sequences' which matches the new issue's 'TY=not a tty' terminal corruption and exit code -1 problems.
I experienced the same issue and found a working solution. Sharing my workaround for those who have kiro-cli installed.
Root Cause
The Kiro CLI post block in .bashrc executes kiro-cli init bash post, which outputs unwanted strings and overwrites the exit code when Kiro runs commands.
Solution
Make the Kiro CLI post block conditional at the bottom of .bashrc:
# Kiro CLI post block. Keep at the bottom of this file.
if [[ "$TERM_PROGRAM" != "kiro" ]]; then
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash"
fi
Results
Before:
> ls -la
TY=not a tty2026/01/30_04:13:58 :~/workspace
[user@host workspace] (main *+)
Exit Code: -1
After:
> ls -la
total 20
drwxr-xr-x. 3 user user 42 Jan 30 04:11 .
drwx------. 21 user user 16384 Jan 30 04:28 ..
-rw-r--r--. 1 user user 1584 Jan 30 04:27 file.txt
Exit Code: 0
This approach uses the TERM_PROGRAM=kiro environment variable that Kiro automatically sets.
This is not working.
On Fri, Jan 30, 2026 at 10:22 AM tdHiru @.***> wrote:
tdHiru left a comment (kirodotdev/Kiro#5240) https://github.com/kirodotdev/Kiro/issues/5240#issuecomment-3821798969
I experienced the same issue and found a working solution. Root Cause
The Kiro CLI post block in .bashrc executes kiro-cli init bash post, which outputs unwanted strings and overwrites the exit code when Kiro runs commands. Solution
Make the Kiro CLI post block conditional at the bottom of .bashrc:
Kiro CLI post block. Keep at the bottom of this file.if [[ "$TERM_PROGRAM" != "kiro" ]]; then
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash"fiResults
Before:
ls -la TY=not a tty2026/01/30_04:13:58 :~/workspace @.*** workspace] (main *+) Exit Code: -1
After:
ls -la total 20 drwxr-xr-x. 3 user user 42 Jan 30 04:11 . drwx------. 21 user user 16384 Jan 30 04:28 .. -rw-r--r--. 1 user user 1584 Jan 30 04:27 file.txt Exit Code: 0
This approach uses the TERM_PROGRAM=kiro environment variable that Kiro automatically sets.
— Reply to this email directly, view it on GitHub https://github.com/kirodotdev/Kiro/issues/5240#issuecomment-3821798969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ2WPER65B6A7JGUXUXCW434JLPRHAVCNFSM6AAAAACTLJEWF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMRRG44TQOJWHE . You are receiving this because you authored the thread.Message ID: @.***>
This issue has been automatically closed as it appears to be a duplicate of an existing issue.
If you believe this is incorrect, please comment on this issue and a maintainer will review it.
This is not working. ...
It worked fine in my environment (amazon linux), so please review your other .bashrc settings.
Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" complete -C "/usr/local/bin/aws_completer" aws
Kiro CLI post block. Keep at the bottom of this file.
if [[ "$TERM_PROGRAM" != "kiro" ]]; then [[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" fi
On Mon, Feb 2, 2026 at 12:30 PM tdHiru @.***> wrote:
tdHiru left a comment (kirodotdev/Kiro#5240)
This is not working. ...
It worked fine in my environment (amazon linux), so please review your other .bashrc settings.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I am also attaching the screenshot for more clarity.
The extra message " TY=not a tty " appears in KIRO-IDE interactive message chat windows with exit code -1
It is not observerd in any terminal. event within KIRO IDE terminal too.
But becasues of Exit code -1 kiro gives error and deviate to other taks.
On Mon, Feb 2, 2026 at 12:42 PM nilesh vaghela @.***> wrote:
Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" complete -C "/usr/local/bin/aws_completer" aws
Kiro CLI post block. Keep at the bottom of this file.
if [[ "$TERM_PROGRAM" != "kiro" ]]; then [[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" fi
On Mon, Feb 2, 2026 at 12:30 PM tdHiru @.***> wrote:
tdHiru left a comment (kirodotdev/Kiro#5240)
This is not working. ...
It worked fine in my environment (amazon linux), so please review your other .bashrc settings.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Please find the screenshot.
On Mon, Feb 2, 2026 at 12:46 PM nilesh vaghela @.***> wrote:
I am also attaching the screenshot for more clarity.
The extra message " TY=not a tty " appears in KIRO-IDE interactive message chat windows with exit code -1
It is not observerd in any terminal. event within KIRO IDE terminal too.
But becasues of Exit code -1 kiro gives error and deviate to other taks.
On Mon, Feb 2, 2026 at 12:42 PM nilesh vaghela @.***> wrote:
Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" complete -C "/usr/local/bin/aws_completer" aws
Kiro CLI post block. Keep at the bottom of this file.
if [[ "$TERM_PROGRAM" != "kiro" ]]; then [[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" fi
On Mon, Feb 2, 2026 at 12:30 PM tdHiru @.***> wrote:
tdHiru left a comment (kirodotdev/Kiro#5240)
This is not working. ...
It worked fine in my environment (amazon linux), so please review your other .bashrc settings.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
@tdHiru thanks. I encountered a similar issue which I reported in https://github.com/kirodotdev/Kiro/issues/4011. Your work around worked well for me on mac
In my case the issue is with only any docker commands. As of now all other command works well.
Thank you for your feedback! 🙏
The duplicate label has been removed and this issue has been sent back for maintainer review.
A maintainer will review this issue shortly.
✅ Confirmed fix on Ubuntu (bash) — detailed explanation + live tests
The workaround from @tdHiru worked for me. Here's a detailed breakdown for anyone experiencing this.
Root Cause
The file ~/.local/share/kiro-cli/shell/bashrc.post.bash contains:
[ -n "$BASH_VERSION" ] && command -v kiro-cli >/dev/null 2>&1 && eval "$(kiro-cli init bash post --rcfile bashrc)"
When Kiro IDE executes commands internally (e.g., from the AI chat agent), it spawns a shell without a real TTY. The kiro-cli init bash post command outputs unwanted strings including the tty command result (not a tty), which corrupts the command output and causes Exit Code: -1.
This does not affect:
- Kiro CLI (has a real TTY)
- Kiro IDE's integrated terminal (has a pseudo-TTY)
- Any regular terminal emulator
It only affects commands executed by the Kiro IDE agent (chat/agentic mode).
Fix
Replace the Kiro CLI post block at the bottom of ~/.bashrc:
Before:
# Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash"
After:
# Kiro CLI post block. Keep at the bottom of this file.
if [[ "$TERM_PROGRAM" != "kiro" ]]; then
[[ -f "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash" ]] && builtin source "${HOME}/.local/share/kiro-cli/shell/bashrc.post.bash"
fi
⚠️ Important: You must replace the original line, not add the conditional alongside it. @NileshjVaghela reported the fix didn't work, but looking at his comment he had both the original and the conditional version — so the original was still executing and causing the issue.
Bonus: Angular CLI users
If you have source <(ng completion script) in your .bashrc, wrap it with a TTY guard to prevent similar issues:
[ -t 0 ] && source <(ng completion script)
Live tests post-fix
We ran these tests directly from the Kiro IDE agent chat to confirm:
| Command | Before fix | After fix |
|---|---|---|
echo "hola mundo" |
❌ Output lost, TY=not a tty, Exit -1 |
✅ Exit 0 |
.venv/bin/python -c "print('test')" |
❌ Output lost, Exit -1 | ✅ test python — Exit 0 |
| Python stdout + stderr simultaneously | ❌ Output lost or Exit -1 | ✅ Both streams captured — Exit 0 |
pip list | head -5 |
❌ Blocked | ✅ Full output — Exit 0 |
How we diagnosed it
- The literal string
not a ttyis the output of/usr/bin/ttywhen stdin is not a terminal - Using subprocess tests, we confirmed no shell config (NVM, pyenv, SDKMAN) was calling
ttydirectly - Inspecting
bashrc.post.bashrevealedkiro-cli init bash postas the source — it runsttyinternally and its output leaks into the command results - The
TERM_PROGRAM=kiroenv var is set by Kiro IDE, making it a reliable condition to skip the post block
Environment
- Ubuntu 24.04 LTS
- Kiro IDE 0.x (latest stable)
- Kiro CLI (latest)
- bash 5.2
- Also had NVM, pyenv, SDKMAN, Angular CLI loaded in
.bashrc
Please be aware that kiro updates may overwrite the guard in your .bashrc file, check after every update to confirm that it's still in place.