Skip to content

Multiple issues with Amazon Q CLI: fs_write errors and inefficient file search operations #9532

Closed
@evgenijkostin

Description

@evgenijkostin

Describe the bug

I'm encountering two issues when using Amazon Q CLI:

  1. Frequent errors when trying to use the fs_write tool:
    Amazon Q is having trouble responding right now:
    0: failed to print tool, fs_write: No such file or directory (os error 2)

Location:
crates/chat-cli/src/cli/chat/mod.rs:1012

  1. Inefficient file search: Amazon Q uses file enumeration instead of system search commands, which significantly slows down
    operations.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

  1. The fs_write tool should work reliably without "No such file or directory" errors
  2. When searching for files, Amazon Q should use system commands (find, grep, locate, etc.) for fast searching rather than
    sequential file enumeration.

Current Behavior

  1. When trying to modify files, fs_write errors frequently occur, forcing me to use a workaround: creating a new file and renaming
    it instead of direct editing.

  2. When searching for files, Amazon Q "thinks" for a long time, going through files one by one instead of using system search
    commands. When explicitly asked to use OS commands for searching, it starts using them and finds the necessary files almost
    instantly.

Reproduction Steps

  1. For fs_write error:
    • Ask Amazon Q to modify the contents of an existing file
    • Observe the "No such file or directory" error
    • Suggest a workaround (create a new file and rename it)

  2. For search issue:
    • Ask to find a file in the system without specifying to use OS commands
    • Observe long waiting time
    • Ask to use find/grep/locate
    • Observe instant results

Possible Solution

  1. Fix path handling in the fs_write tool for correct operation with the file system
  2. Optimize file search algorithms, using system search commands (find, grep, locate) by default instead of sequential enumeration

Additional Information/Context

These issues significantly reduce the efficiency of working with Amazon Q CLI. Workarounds exist, but they shouldn't be necessary
for basic functionality.

CLI version used

Amazon Q CLI (latest version)

Environment details (OS name and version, etc.)

Linux (Ubuntu/Debian-based distribution)

Metadata

Metadata

Labels

bugThis issue is a bug.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions