Fixed KeyError in _handle_rename by using correct args key#36063
Closed
Tim Ren (xr843) wants to merge 1 commit intolangchain-ai:masterfrom
Closed
Fixed KeyError in _handle_rename by using correct args key#36063Tim Ren (xr843) wants to merge 1 commit intolangchain-ai:masterfrom
Tim Ren (xr843) wants to merge 1 commit intolangchain-ai:masterfrom
Conversation
The tool dispatch function builds the args dict with the source path under key "path", but both _handle_rename implementations read args["old_path"], which never exists. This causes a KeyError whenever the rename command is used. Changed to args["path"] to match the key set in the dispatch function. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
This PR has been automatically closed because you are not assigned to the linked issue. External contributors must be assigned to an issue before opening a PR for it. Please:
|
29 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #35852
anthropic_tools.pybuilds theargsdict with the source file path under key"path"(line 218 and 720), but both_handle_renameimplementations (in_StateClaudeFileToolMiddlewareand_FilesystemClaudeFileToolMiddleware) readargs["old_path"], which is never set.KeyError: 'old_path'whenever therenamecommand is invoked.args["old_path"]toargs["path"]in both_handle_renamemethods.Test plan
argsdict is built with"path"as the key for the source path in both dispatch functions"new_path"is correctly set whennew_pathis provided_StateClaudeFileToolMiddlewareand_FilesystemClaudeFileToolMiddlewareto confirm no KeyError🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com