Cannot read properties of undefined (reading 'replace')
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues
Operating System
macOS 26.1
Kiro Version
0.8.140
Bug Description
When trying to select my code as context in Kiro IDE
- Right-click and select the code blocks in each of my files.
- Select "Kiro" > "Chat"
the chat dialog appears with message: "We've encountered an unknown error Cannot read properties of undefined (reading 'replace')"
Steps to Reproduce
Bug Reproduction: When selecting a file containing spaces, such as hello world.md, the error "Cannot read properties of undefined (reading 'replace')" occurs.
But if I remove the spaces from the file, such as helloworld.md, the error doesn't occur.
Expected Behavior
Files containing spaces will cause errors; removing the spaces will prevent these errors.
Conversation ID
No response
Additional Context
hello world.md hello world.py hello_world.py hello-world.md
This is the file I tested.
Below is my Kiro version. Version: 0.8.140 VSCode Version: 1.103.2 Commit: e9761ecebe507c32c4eefdc1f4f0a85a2bb29529 Date: 2026-01-16T00:53:18.181Z (1 wk ago) Electron: 37.10.2 ElectronBuildId: undefined Chromium: 138.0.7204.251 Node.js: 22.21.1 V8: 13.8.258.32-electron.0 OS: Darwin arm64 25.1.0
Hey 👋 , Thanks for raising this. We are already tracking this issue here #2225. Feel free to upvote or add comment there.