aws / aws/amazon-q-developer-cli
Issues with fs_write when trying to modify .zshrc file
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
macOS 15.4.0 (24E248)
### Expected behaviour
The fs_write function should successfully append or modify the .zshrc file to add the requested alias.
### Actual behaviour
When trying to use fs_write to add an alias to the user's .zshrc file, the operation is being cancelled with "Tool use was cancelled by the user" error.
```
[chat-transcript]
> are you able to add an alias to my shell that when I type rider . it behaves much like code . for VS Code but instead of opening VS Code with the current directory in context it open the Rider IDE?
I can help you add an alias to your shell that opens JetBrains Rider with the current directory. Let me first check if Rider is installed on your system and find its location.
[Tool uses: execute_bash]
> y
I see Rider is installed at `/Applications/Rider.app`. Now let's determine which shell you're using so I can add the alias to the correct configuration file:
[Tool uses: execute_bash]
You're using zsh as your shell. Let's add the alias to your `.zshrc` file:
[Tool uses: fs_read]
Now I'll add the alias for Rider to your `.zshrc` file:
[Tool uses: fs_write]
Amazon Q is having trouble responding right now:
0: failed to print tool: No such file or directory (os error 2)
Location:
crates/q_cli/src/cli/chat/mod.rs:676
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
> q issue
I apologize for the error. Let me try again with a different approach to add the Rider alias to your shell configuration.
[Tool uses: fs_write]
Amazon Q is having trouble responding right now:
0: failed to print tool: No such file or directory (os error 2)
Location:
crates/q_cli/src/cli/chat/mod.rs:676
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
> q issue
I apologize for the issues with adding the alias to your shell configuration. Let me try a different approach.
[Tool uses: report_issue]
```
### Steps to reproduce
1. User asked to add a 'rider' alias to open JetBrains Rider IDE
2. Attempted to use fs_write with str_replace and then with append command
3. Both attempts resulted in "Tool use was cancelled by the user" error
### Environment
```yaml
[q-details]
version = "1.7.3"
hash = "3e4ae79d371315e80ddac772b43fff2cba314104"
date = "2025-04-10T05:48:16.435186Z (7d ago)"
variant = "full"
[system-info]
os = "macOS 15.4.0 (24E248)"
chip = "Apple M1 Max"
total-cores = 10
memory = "32.00 GB"
[environment]
cwd = "/Users/USER/Documents/dev/playground-storybook-teller"
cli-path = "/Users/USER/Documents/dev/playground-storybook-teller"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "macOS"
install-method = "unknown"
[env-vars]
PATH = "/usr/local/share/dotnet:/usr/local/bin:/Users/USER/.nvm/versions/node/v23.2.0/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.13/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:/usr/local/share/dotnet:~/.dotnet/tools:/Users/USER/.cargo/bin:/Users/USER/.local/bin:/Applications/Docker.app/Contents/Resources/bin"
QTERM_SESSION_ID = "41c3ea1aaf06413fbc7613bbe106b906"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.7.3"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.apple.Terminal"
[chat-settings]
interactive=true
[chat-trusted_tools]
[chat-failed_request_ids]
none
[chat-context]
current_profile=default
profiles=
default
global_context=
.amazonq/rules/**/*.md
README.md
AmazonQ.md
profile_context=none
files=
/Users/guimathe/Documents/dev/playground-storybook-teller/README.md, 1036 B
total context size=1036 B
```
Contributor guide
Assessment
This issue has not been assessed yet.