8000 Issue: write_to_file tool truncates large files · Issue #1921 · RooVetGit/Roo-Code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue: write_to_file tool truncates large files #1921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
benzntech opened this issue Mar 23, 2025 · 5 comments
Open

Issue: write_to_file tool truncates large files #1921

benzntech opened this issue Mar 23, 2025 · 5 comments
Labels
bug Something isn't working needs scoping Needs up-front scoping to be actionable

Comments

@benzntech
Copy link
benzntech commented Mar 23, 2025

Issue: write_to_file tool truncates large files

Description:

The write_to_file tool consistently truncates files when writing content exceeding a certain size (approximately 285 lines in my testing). This prevents me from creating complete files, such as test suites, and hinders my ability to complete tasks effectively.

Steps to Reproduce:

  1. Attempt to write a file with more than 285 lines using the write_to_file tool.
  2. Observe that the resulting file is incomplete and truncated.

Expected Behavior:

The write_to_file tool should be able to write files of any size without truncation.

Workaround (if any):

Currently, there is no reliable workaround. Attempts to use apply_diff also fail due to the incomplete initial file. Splitting the content into smaller chunks and writing sequentially also fails.

Environment:

  • Tool: write_to_file
  • Project Directory: /root/Project/Xeenux
  • Current Mode: code

Additional Information:

I have repeatedly tried to write the same file, and the truncation consistently occurs. This suggests a limitation within the tool itself.

The apply_diff tool failed because the diff format was incorrect. I apologize for the error. I will reconstruct the diff string with the correct format, including the <<<<<<< SEARCH, =======, and >>>>>>> REPLACE markers, and retry the apply_diff operation. I will also ensure the entire content is included in the diff.

Originally posted by @benzntech in #1559

Image

@dosubot dosubot bot added the bug Something isn't working label Mar 23, 2025
@hannesrudolph
Copy link
Collaborator

What model are you using through which provider @benzntech ? Do you have clear repro steps you could provide please?

@hannesrudolph hannesrudolph moved this from New to Issue [Needs Info] in Roo Code Roadmap Mar 26, 2025
@hannesrudolph hannesrudolph added the needs information Needs more information to be actionable label Mar 26, 2025
8000 @benzntech
Copy link
Author

Will all the provider same issue @hannesrudolph

@hannesrudolph hannesrudolph closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2025
@github-project-automation github-project-automation bot moved this from Issue [Needs Info] to Done in Roo Code Roadmap Mar 27, 2025
@hannesrudolph hannesrudolph reopened this Apr 1, 2025
@tobalsan
Copy link
tobalsan commented Apr 1, 2025

I frequently encounter the same issue when using the Gemini 2.0 Flash 001 model.

I ask RooCode to scrape data from the web, which it does nicely. Then I ask it to write the scraped data to a markdown file, and that's when I get the same error message.

Image

Note that the content here, for instance, isn't actually 717 lines, only 293.

What's weird:

  • Sometimes it doesn't happen at all.
  • When it happens, sometimes when I click "Retry" a few times it successfully terminates.
  • Other times it just won't be successful. It will still have written the file, all I have to do is to terminate the task.

@hannesrudolph
Copy link
Collaborator

@tobalsan The reason for this is that this model does not adhere to tool calls consistently. It works one call and then not the next and then often keeps trying the same thing over and over. That being said, we made some changes to our system prompt which have increased the success rate of tool use for this specific model.

@abda11ah
Copy link
abda11ah commented May 5, 2025

I think the write_to_file tool should first write to a temporary file and then renaming it over the original.
It is a common safe practice (atomic write), to avoid ending up with a truncated file in case of a cancellation.

@hannesrudolph hannesrudolph reopened this May 7, 2025
@hannesrudolph hannesrudolph moved this from Done to Issue [Needs Scoping] in Roo Code Roadmap May 7, 2025
@hannesrudolph hannesrudolph added needs scoping Needs up-front scoping to be actionable and removed needs information Needs more information to be actionable labels May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs scoping Needs up-front scoping to be actionable
Projects
Status: Issue [Needs Scoping]
Development

No branches or pull requests

4 participants
0