Kiro in WSL doesn't escape paths correctly
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues
Operating System
Windows 11, WSL, Ubuntu 24
Kiro Version
0.1.42
Bug Description
Whenever Kiro attempts to run a command, it will generally attempt to place a cd "\\wsl.localhost\Ubuntu\home\... inline. This isn't properly escaped on Linux and always fails to go to a directory. It then attempts to run the command which just does the task in whatever directory you happen to be in. It has made Kiro almost unusable on WSL.
Steps to Reproduce
- Open Kiro in WSL with a project that you're adding to
- Ask it to add a new portion of the project outside of the current directory structure (like generating a front end)
- It will likely attempt to run a vite creation right in the directory you're in currently, then install node modules outside of the project directory you just created.
Expected Behavior
Kiro should properly escape the "\ or remove the quotes.
Conversation ID
No response
Additional Context
No response
Experiencing the same issue in Kiro 0.7.45. Connection is being made to WSL via the extension open-remote-wsl
I have a similar issue.
It always adds a windows style path to cd, for example:
cd "c:\path\to\project\xxx" ; npm install
I tried it on Windows and also remote on WSL.
Yep, same here. I feel it has something to do with open-remote, and the pwd context it's providing. When I observe the path hints for files in a workspace when using open-remote, I can see a UNC path like Qworg does of \\wsl.localhost\Ubuntu\.... Even if this was escaped properly, I doubt it would work correctly within WSL, since it's the UNC path to that same WSL instance.
It all makes sense from the context that Kiro has, but I think something needs to be added so that it has the ability to ID the current shell it is within, and adjust UNC paths accordingly. Steering helped a little bit in some circumstances, but it always eventually reverted to trying to cd into an unescaped UNC path while in a bash terminal.
This is seriously one of the most annoying bugs. The solution is to support WSL so that we can have easy hybrid solutions. I want my projects in WSL, but run Kiro on Windows (the best of both worlds). This used to work in the baseline VSCode since the WSL support was a standard plugin. This needs to be supported. I'm not installing Kiro in my WSL image. Open-remote WSL doesn't solve it anymore.
The issue is that Kiro does not understand the commands are being run in a WSL (linux) environment and therefore tries to use the Windows path. I could not find an option to change this behavior or instruct Kiro to use linux-formatted paths, which would solve the issue.
Workaround:
Create a cd function in your shell .rc file that calls wslpath to resolve Windows paths to Linux paths if a Windows path argument (<drive>:\) is detected.
Add this to your .bashrc (or other shell .rc) and start a new terminal session:
function cd() {
if [[ $1 == ?':\'* ]]; then
\builtin cd $(wslpath "$1")
else
\builtin cd $1
fi
}
Actually I had the same problem. The simplest solution is to start kiro from your wsl prompt and then kiro will run all paths from the shell
Get Outlook for iOShttps://aka.ms/o0ukef
From: Antti Tuomi @.> Sent: Friday, April 17, 2026 11:55:14 PM To: kirodotdev/Kiro @.> Cc: Tom Richards @.>; Comment @.> Subject: Re: [kirodotdev/Kiro] Kiro in WSL doesn't escape paths correctly (Issue #1757)
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
[https://avatars.githubusercontent.com/u/12746425?s=20&v=4]astuomi left a comment (kirodotdev/Kiro#1757)https://github.com/kirodotdev/Kiro/issues/1757#issuecomment-4272757774
The issue is that Kiro does not understand the commands are being run in a WSL (linux) environment and therefore tries to use the Windows path. I could not find an option to change this behavior or instruct Kiro to use linux-formatted paths, which would solve the issue.
Workaround:
Create a cd function in your shell .rc file that calls wslpath to resolve Windows paths to Linux paths if a Windows path argument (
Add this to your .bashrc (or other shell .rc) and start a new terminal session:
function cd() { if [[ $1 == ?':'* ]]; then \builtin cd $(wslpath "$1") else \builtin cd $1 fi }
— Reply to this email directly, view it on GitHubhttps://github.com/kirodotdev/Kiro/issues/1757?email_source=notifications&email_token=BFJ26X7UTE2B7LAZMYFOXDL4WMDDFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGI3TKNZXG42KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4272757774, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFJ26XYFAEWOCPNA5I675AD4WMDDFAVCNFSM6AAAAACDDZZD4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENZSG42TONZXGQ. You are receiving this because you commented.Message ID: @.***>
The information transmitted by this email is intended only for the person or entity to whom it is addressed. This email may contain proprietary, confidential, or privileged information of symplr. If you are not the intended recipient of this email, be aware that any use, review, retransmission, distribution, reproduction, or any action taken in reliance upon this email is strictly prohibited. If you received this email in error, please delete the material immediately and notify the sender. (NB57E5WAL)
Same root cause, Windows-filesystem variant + partial workaround findings
Confirming this on a Windows-filesystem project (not Open Remote - WSL). #8658 has the clearest root-cause writeup for the general bug (Kiro prepends cd "<path>" ; instead of setting cwd at process-spawn level).
Environment
- Kiro 1.0.395 (user setup), commit 3a3248f
- Windows 11 (10.0.26200) + WSL2 Ubuntu 24.04,
/bin/bash - Project on the Windows filesystem (
C:\git\personal\...), multi-root workspace (2 folders), WSL as the terminal shell
Symptoms
- Injected
cduses a mangled path. Two forms observed: the rawc:\git\personal\...and a half-translated\mnt\c\git\personal\...(correct/mnt/cmount but Windows backslashes). - Intermittent terminal launch failure:
The terminal process failed to launch: Starting directory (cwd) "\mnt\c\git\personal\..." does not exist. - When the injected
cdfails silently, commands run in the default (first) workspace folder, so in a multi-root workspace they can hit the wrong repo — a silent correctness hazard.
Partial workaround: launch Kiro from a WSL shell
Launching Kiro from WSL (kiro .) eliminated the launch failures and the Exit Code -1 output-capture problem. It did not fix the mangled cd — commands targeting a non-default workspace folder still land in the default folder.
Working workaround: override cd in .bashrc
Handles both mangled forms and passes normal paths through untouched:
cd() {
local target="$1"
if [[ "$target" =~ ^[A-Za-z]:[\\/] ]]; then # C:\... form
local p; p="$(wslpath -u "$target" 2>/dev/null)"
[[ -n "$p" ]] && { builtin cd "$p"; return; }
elif [[ "$target" == \\* ]]; then # \mnt\c\... form
builtin cd "${target//\\//}"; return
fi
builtin cd "$@"
}
Note: wslpath alone isn't enough — it turns \mnt\c\... into /mnt/c/mnt/c/..., so the backslash form needs a plain slash-swap instead.
The real fix, per #8658, is to pass cwd as a process-spawn option rather than injecting a cd string.
Update note: I have also implemented all of the workarounds covered in https://mcgarrah.org/kiro-ide-wsl2-integration and it seems like a lot of the path issues are solved from my extensive testing.