Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

fsWrite/strReplace intermittently return "Tool not available" mid-session

Open mgregier opened this issue 5 months ago • 9 comments

Before opening, please confirm:

Operating System

macOS (darwin), shell: zsh

Kiro Version

Version: 1.0.0 VSCode Version: 1.107.1 Commit: 0974fb9837d3a1c159ee4016bbbcd4fc21e14111

Bug Description

Summary

Within a single active Kiro session, the file-mutation tools fsWrite and strReplace intermittently start returning Tool "fs_write" is not available. / Tool "str_replace" is not available. — even though fsWrite had already succeeded earlier in the same session. Once the failure starts it persists across turns. Read-only tools are unaffected.

Environment

  • Kiro IDE (VS Code based), Autopilot mode, Spec session
  • OS: macOS (darwin), shell: zsh
  • Model: Auto
  • Multi-root workspace (2 folders open)
  • Target file lived under .kiro/specs/<feature>/requirements.md

Steps to Reproduce

  1. Start a Spec session in a multi-root workspace.
  2. Have the agent create several files with fsWrite (these succeed — verified by reading them back with readFile).
  3. Continue the session; later ask the agent to update one of those files via fsWrite (full overwrite) or strReplace (targeted edit).
  4. Observe the tool call return Tool "fs_write" is not available. / Tool "str_replace" is not available.

Expected Behavior

Expected behavior

fsWrite and strReplace remain available for the entire session and the edit is applied (or returns an actionable error such as a permission prompt).

Actual behavior

  • strReplace returned Tool "str_replace" is not available. on first use.
  • fsWrite then returned Tool "fs_write" is not available. on every subsequent attempt, despite having worked at least 3 times earlier in the same session (file creation confirmed via readFile).
  • Retried across multiple turns and user messages — consistently failed.
  • No workspace, permission, or settings changes occurred between the working and failing calls.

What still worked

readFile, readFiles, listDirectory, grepSearch, fileSearch, and web search continued to function normally throughout.

Impact

Hard blocker for Spec workflows and any code-editing task: the agent cannot persist requirements/design/tasks documents or apply code changes once the failure begins. The only workaround is to abandon the session or hand edits back to the user to apply manually.

Additional context / questions

  • Is tool availability re-evaluated mid-session (e.g. after context compaction, a token/permission refresh, or an MCP/tool registry reload)? The transition from "available" to "not available" within one session suggests the tool registry is being dropped or not re-attached.
  • Possibly related to multi-root workspaces and/or absolute paths outside the primary workspace folder.

Conversation ID

sess_e3373131-bce2-4c59-bf5c-af03f43f377e

Additional Context

No response

mgregier avatar Jun 24 '26 13:06 mgregier

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both issues report repeated failures of file write tools (fsWrite/strReplace) when working with spec documents in Kiro, with the tools becoming unavailable mid-session while read-only tools continue to work normally

github-actions[bot] avatar Jun 24 '26 13:06 github-actions[bot]

Can someone have a look at these issues? Kiro IDE is completely not usable now.

mgregier avatar Jun 25 '26 22:06 mgregier

Thank you for your feedback! 🙏

The 👎 reaction has been noted. The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Jun 25 '26 22:06 github-actions[bot]

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Jun 25 '26 22:06 github-actions[bot]

Hi! Several updates have shipped since this was filed — the latest is Kiro IDE 1.0.52, which includes fixes to tool availability and multi-root workspace handling. Could you update and let us know if fs_write/str_replace still disappear mid-session?

To update: download from kiro.dev.

If the issue persists after updating, please share:

  • Your current version (Help → About)
  • Whether it still only happens in multi-root workspaces
  • A new Conversation ID if possible

AnilMaktala avatar Jun 26 '26 20:06 AnilMaktala

I'm on OSX and just checked for updates, but I already have the latest version:

Version: 1.0.0 VSCode Version: 1.107.1 Commit: 0974fb9837d3a1c159ee4016bbbcd4fc21e14111 Date: 2026-06-17T02:33:34.894Z Electron: 39.6.0 Chromium: 142.0.7444.265 Node.js: 22.22.0 V8: 14.2.231.22-electron.0 OS: Darwin arm64 25.3.0

I changed permissions.yaml to:

rules:

  • capability: all effect: allow
  • capability: shell match:
    • "*"

After that, it looks like writing files works, but it's still asking for permission when modifying them. I think, in general, something is wrong with executing shell commands (I'm running ZSH) because recently I also have errors with "Network-bound commands are returning empty with no captured output, while local commands work fine. Let me probe connectivity quickly." For example, when asking Kiro to execute a git command. Here sample conversation ID: sess_7789d7a9-8423-4b2f-9ef1-5e5f36cf07f1 What is strange is that those issues do not happen in Kiro CLI v2 and v3.

mgregier avatar Jun 29 '26 12:06 mgregier

I downloaded the latest version, and indeed it's fixed. Tell me why "check for updates" didn't download the latest version, but I need to download it from the website?

mgregier avatar Jun 29 '26 16:06 mgregier

Still reproducing on Kiro 1.0.52 (macOS) - root cause: switching to Plan Mode disables MCP

Environment:

  • Kiro IDE 1.0.52
  • macOS (Darwin arm64)
  • Multi-root workspace (11 folders)
  • MCP server affected: Atlassian Rovo (StreamableHTTP transport)

Root cause: Switching a session from Default mode to Plan mode fires _kiro/mcp/toggle: enabled=false and never re-enables it. MCP tools become permanently unavailable for the rest of the session (and even across Kiro restarts).

Evidence from kiro.log:

The token refresh warnings ran for ~20 minutes without disabling MCP. MCP was only disabled at the exact moment of the mode switch:

16:11:36 [KiroAgent] _kiro/mcp/toggle: enabled=true        <-- session started in Default mode
16:29:10 [ACPModelConfigProvider] Failed to refresh models: No valid token found
16:34:39 [ACPModelConfigProvider] Failed to refresh models: No valid token found
16:39:39 [ACPModelConfigProvider] Failed to refresh models: No valid token found
16:44:39 [ACPModelConfigProvider] Failed to refresh models: No valid token found
                                                            ^^^ MCP still enabled through all of this
16:48:29 [KiroAgent] _kiro/mcp/toggle: enabled=false        <-- mode switch to Plan
16:48:29 [KiroAgent] MCP subsystem disabled

Also note the model count changes at the same moment (9 -> 10 models), confirming a re-initialization event:

16:11:33 [ACPModelConfigProvider] Loaded 9 models           <-- Default mode
16:49:40 [ACPModelConfigProvider] Loaded 10 models          <-- Plan mode, different model set

The session's session.json confirms "agentMode": "plan".

Timeline of impact on the session:

Time (UTC) Event
16:48:44 Last successful Rovo MCP call (likely in-flight on old connection)
16:58:31 Tool "mcp_atlassian_rovo_search" is not available.
17:15:18-32 5 consecutive MCP tool calls all fail with "not available"
17:20:06 Kiro restarts - MCP still enabled=false on init

Steps to reproduce:

  1. Start a session in Default mode
  2. Use an MCP tool (confirm it works)
  3. Switch to Plan mode mid-session
  4. Try using an MCP tool again - fails with "Tool not available"

The fix needed: The mode-switch re-initialization path needs to preserve/restore MCP enabled state, or re-enable MCP after the mode transition completes.

claytonolley avatar Jul 03 '26 17:07 claytonolley

Possibly related data point, from Kiro IDE 1.1.70 on macOS: in a spec session, Tool "str_replace" is not available. can be deterministic rather than intermittent. The spec-mode orchestrator's toolset ([SPEC_GRAPH] Tool selection, 36 tools) doesn't include the edit tools at all, and edits appear to be meant to go through the spec-workflow subagent. The extension log records these calls as Tool not found: "str_replace", while the model sees the "is not available" wording quoted in this issue.

So a session that edits fine in Default mode and then moves into Spec mode will get this message whenever the agent reaches for an edit tool. In our original session it did so twice before delegating. That may explain some reports here. It doesn't rule out the genuine mid-session loss originally described.

Full repro, including the subagent side (which has edit tools but not validate_spec_format), is in #11695.

rickmi avatar Sep 30 '26 15:09 rickmi