Skip to content

bug: fs_write failing on paths with "~" #1932

@aneekm

Description

@aneekm

Checks

Operating system

MacOS

Expected behaviour

The fs_write tool correctly displays the diff requested by the model to accept or deny.

Actual behaviour

fs_write returns the error:

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:1007

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

when it tries to display the diff generated by the model. I ran q chat -vvv and saw that the model returned valid-looking output so I expect it's something client-side with how the tool call is being processed.

Steps to reproduce

Here's the chat log, I repeated this with a couple different files in my home directory and they all behaved the same when I used ~/ in the path.

$ q chat 
⚠ amzn_mcp has the following warning:
The following tool names are changed:
 - amzn_mcp___slack-send-message -> amzn_mcp___slacksendmessage
✓ 1 of 1 mcp servers initialized.

    ⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
 ⠀⠀⠀⣾⡿⢻⣿⡆⠀⠀⠀⢀⣄⡄⢀⣠⣤⣤⡀⢀⣠⣤⣤⡀⠀⠀⢀⣠⣤⣤⣤⣄⠀⠀⢀⣤⣤⣤⣤⣤⣤⡀⠀⠀⣀⣤⣤⣤⣀⠀⠀⠀⢠⣤⡀⣀⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠋⠀⠀⠀⠙⣿⣿⡆
 ⠀⠀⣼⣿⠇⠀⣿⣿⡄⠀⠀⢸⣿⣿⠛⠉⠻⣿⣿⠛⠉⠛⣿⣿⠀⠀⠘⠛⠉⠉⠻⣿⣧⠀⠈⠛⠛⠛⣻⣿⡿⠀⢀⣾⣿⠛⠉⠻⣿⣷⡀⠀⢸⣿⡟⠛⠉⢻⣿⣷⠀⠀⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⢸⣿⣿
 ⠀⢰⣿⣿⣤⣤⣼⣿⣷⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⢀⣴⣶⣶⣶⣿⣿⠀⠀⠀⣠⣾⡿⠋⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⡇⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⣇⠀⠀⠀⠀⠀⢸⣿⡿
 ⢀⣿⣿⠋⠉⠉⠉⢻⣿⣇⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⣿⣿⡀⠀⣠⣿⣿⠀⢀⣴⣿⣋⣀⣀⣀⡀⠘⣿⣿⣄⣀⣠⣿⣿⠃⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣦⣀⣀⣀⣴⣿⡿⠃
 ⠚⠛⠋⠀⠀⠀⠀⠘⠛⠛⠀⠘⠛⠛⠀⠀⠀⠛⠛⠀⠀⠀⠛⠛⠀⠀⠙⠻⠿⠟⠋⠛⠛⠀⠘⠛⠛⠛⠛⠛⠛⠃⠀⠈⠛⠿⠿⠿⠛⠁⠀⠀⠘⠛⠃⠀⠀⠘⠛⠛⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⣿⣿⣋⠀⠀
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢿⡧

╭─────────────────────────────── Did you know? ────────────────────────────────╮
│                                                                              │
│     You can resume the last conversation from your current directory by      │
│                        launching with q chat --resume                        │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

/help all commands  •  ctrl + j new lines  •  ctrl + s fuzzy search
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Write an appropriate header comment on my file ~/karakuri-checkstyle.xml
I'll help you write an appropriate header comment for your karakuri-checkstyle.xml file. Let me 
first check if the file exists and what it contains.


🛠️  Using tool: fs_read (trusted)
 ⋮ 
 ● Reading file: ~/karakuri-checkstyle.xml, all lines
 ⋮ 
 ● Completed in 0.0s


Now I'll create an appropriate header comment for your karakuri-checkstyle.xml file:


🛠️  Using tool: fs_write
 ⋮ 
 ● Path: ~/karakuri-checkstyle.xml

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:1007

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
> Try again, it's in your local directory
I'll try again with the correct path. Let me check if the file exists in my current directory.


🛠️  Using tool: fs_read (trusted)
 ⋮ 
 ● Reading file: /Users/mukhanee/karakuri-checkstyle.xml, all lines
 ⋮ 
 ● Completed in 0.0s



🛠️  Using tool: fs_write
 ⋮ 
 ● Path: karakuri-checkstyle.xml

  1,  1: <?xml version="1.0"?>
  2,  2: <!DOCTYPE module PUBLIC
  3,  3:         "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
  4,  4:         "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
  5,  5: 
  6,  6: <!--
- 7    :         Based on Java code conventions:
- 8    :         http://www.oracle.com/technetwork/java/codeconv-138413.html
+     7:     Karakuri Checkstyle Configuration
+     8:     
+     9:     Purpose: Enforces code style and quality standards for the Karakuri project
+    10:     
+    11:     This configuration is based on Java code conventions:
+    12:     http://www.oracle.com/technetwork/java/codeconv-138413.html
+    13:     
+    14:     It includes checks for:
+    15:     - Naming conventions
+    16:     - Import statements
+    17:     - Code structure and formatting
+    18:     - Common coding problems
+    19:     - Class design
+    20:     - Code complexity metrics
+    21:     
+    22:     Last updated: 2025-05-21
+    23:     
+    24:     Usage:
+    25:     - Apply with Maven: mvn checkstyle:check
+    26:     - Apply with Gradle: ./gradlew checkstyleMain checkstyleTest
+    27:     - IDE integration available via plugins
  9, 28: -->


Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]:

> /quit

Environment

$ q diagnostic

[q-details]
version = "1.10.1"
hash = "cb90e381cf8391beef4b966623d913e258cbb08d"
date = "2025-05-16T13:53:39.016927Z (5d ago)"
variant = "full"

[system-info]
os = "macOS 15.4.1 (24E263)"
chip = "Apple M3 Pro"
total-cores = 12
memory = "36.00 GB"

[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "macOS"
install-method = "brew"

[env-vars]
PATH = "/Users/USER/.nvm/versions/node/v22.11.0/bin:/Users/USER/.cargo/bin:/Users/USER/.toolbox/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/USER/.local/bin"
QTERM_SESSION_ID = "7e2008a360d5439697d85b56fe32cea0"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.10.1"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.apple.Terminal"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    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