kilocode
kilocode copied to clipboard
Encountering "Edit Unsuccessful" Repeatedly
Description
Description
When running a large task, it first reads many files, and the reading process works normally. However, once it starts modifying the files, all operations fail with the following error message:
Edit Unsuccessful
Failed to parse apply_diff XML: Failed to parse XML: StopNode is not closed.
I am using the free model X-ai / Grok Code Fast 1.
i got in the past 2 days all updated vscode and kilo extension this error, any solution ?
I have the same issue. the editing tools are poor performance and low success rate in kilocode and all other forks.
Same
Same +1. BTW, it seems that when the context exceed 128k the problem occurs.
i m also getting it from now on, I think only in pycharm it is coming not in vs code
I have the same issue, also on Grok Code Fast 1, on WebStorm as JetBrains plugin v4.112.1, even with context sizes at around ~50-60k this occurs. Usually this doesn't happen for new tasks/chats, but starts happening after additional user messages.
me too vs code Version: 1.105.1 and Version: 4.112.1 (4eb24d28)
This also happens for grok-4.1-fast-reasoning, on WebStorm with Kilo Code plugin v4.124.0
This somehow makes the model think it's successfully editing the file and will continue editing other files and/or updating the todo list. If you need more info, please let me know I'll be happy to provide it! You can also reach me on kilo code's discord server.
See the partial log of the task history
...
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T21:59:12.224Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.02
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
You have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.
</environment_details>
---
**Assistant:**
<apply_diff>
<args>
<file>
<path>src/actions/media.ts</path>
<diff>
<content><![CDATA[
<<<<<<< SEARCH
console.error("Error scanning media issues:", error);
return { success: false, error: "Failed to scan media issues" };
}
};
=======
console.error("Error scanning media issues:", error);
return { success: false, error: "Failed to scan media issues
---
**User:**
[apply_diff for 'src/actions/media.ts'] Result:
Failed to parse apply_diff XML. This usually means:
1. The XML structure is malformed or incomplete
2. Missing required <file>, <path>, or <diff> tags
3. Invalid characters or encoding in the XML
Expected structure:
<args>
<file>
<path>relative/path/to/file.ext</path>
<diff>
<content>diff content here</content>
<start_line>line number</start_line>
</diff>
</file>
</args>
Original error: Failed to parse XML: StopNode is not closed.
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:00:26.580Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.02
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
You have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.
</environment_details>
---
**Assistant:**
<insert_content>
<path>src/actions/media.ts</path>
<line>0</line>
<content>
export const updateFileSizes
---
**User:**
[insert_content for 'src/actions/media.ts'] Result:
<file_write_result>
<path>src/actions/media.ts</path>
<operation>modified</operation>
<notice>
<i>You do not need to re-read the file, as you have seen all changes</i>
<i>Proceed with the task using these changes as the new baseline.</i>
</notice>
</file_write_result>
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:00:32.086Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.02
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
You have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.
</environment_details>
---
**Assistant:**
<apply_diff>
<args>
<file>
<path>src/app/dashboard/media/page.tsx</path>
<diff>
<content><![CDATA[
<<<<<<< SEARCH
import { auth } from "@/lib/gel";
=======
import
---
**User:**
[apply_diff for 'src/app/dashboard/media/page.tsx'] Result:
Failed to parse apply_diff XML. This usually means:
1. The XML structure is malformed or incomplete
2. Missing required <file>, <path>, or <diff> tags
3. Invalid characters or encoding in the XML
Expected structure:
<args>
<file>
<path>relative/path/to/file.ext</path>
<diff>
<content>diff content here</content>
<start_line>line number</start_line>
</diff>
</file>
</args>
Original error: Failed to parse XML: StopNode is not closed.
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:00:40.654Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.03
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
You have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.
</environment_details>
---
**Assistant:**
<update_todo_list>
<todos>
[x] Previous tasks complete
[-] Add updateFileSizes server
---
**User:**
[update_todo_list] Result:
Todo list updated successfully.
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:00:45.975Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.03
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
====
REMINDERS
Below is your current list of reminders for this task. Keep them updated as you progress.
| # | Content | Status |
|---|---------|--------|
| 1 | Previous tasks complete | Completed |
| 2 | Add updateFileSizes server | In Progress |
IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.
</environment_details>
---
**Assistant:**
<insert_content>
<path>src/actions/media.ts</path>
<line>0</line>
<content>
export const updateFileSizes = async () => {
const session
---
**User:**
[insert_content for 'src/actions/media.ts'] Result:
<file_write_result>
<path>src/actions/media.ts</path>
<operation>modified</operation>
<notice>
<i>You do not need to re-read the file, as you have seen all changes</i>
<i>Proceed with the task using these changes as the new baseline.</i>
</notice>
</file_write_result>
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:00:55.605Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.03
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
====
REMINDERS
Below is your current list of reminders for this task. Keep them updated as you progress.
| # | Content | Status |
|---|---------|--------|
| 1 | Previous tasks complete | Completed |
| 2 | Add updateFileSizes server | In Progress |
IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.
</environment_details>
---
**Assistant:**
<update_todo_list>
<todos>
[x] Add updateFileSizes server action to src/actions/media.ts
[-] Update src/app/dashboard/media/page.tsx to fetch and pass isAdmin prop
[ ] Update src/app/dashboard/media/MediaToolbar.tsx to include Update Sizes button for admins
[ ] Update src/app/dashboard/media/MediaManager.tsx to handle update sizes state, handler, pass to toolbar, and show progress bar
</todos>
</update_todo_list>
---
**User:**
[update_todo_list] Result:
Todo list updated successfully.
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:01:01.087Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.05
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
====
REMINDERS
Below is your current list of reminders for this task. Keep them updated as you progress.
| # | Content | Status |
|---|---------|--------|
| 1 | Add updateFileSizes server action to src/actions/media.ts | Completed |
| 2 | Update src/app/dashboard/media/page.tsx to fetch and pass isAdmin prop | In Progress |
| 3 | Update src/app/dashboard/media/MediaToolbar.tsx to include Update Sizes button for admins | Pending |
| 4 | Update src/app/dashboard/media/MediaManager.tsx to handle update sizes state, handler, pass to toolbar, and show progress bar | Pending |
IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.
</environment_details>
---
**Assistant:**
<apply_diff>
<args>
<file>
<path>src/app/dashboard/media/page.tsx</path>
<diff>
<content><![CDATA[
<<<<<<< SEARCH
import { auth
---
**User:**
[apply_diff for 'src/app/dashboard/media/page.tsx'] Result:
Failed to parse apply_diff XML. This usually means:
1. The XML structure is malformed or incomplete
2. Missing required <file>, <path>, or <diff> tags
3. Invalid characters or encoding in the XML
Expected structure:
<args>
<file>
<path>relative/path/to/file.ext</path>
<diff>
<content>diff content here</content>
<start_line>line number</start_line>
</diff>
</file>
</args>
Original error: Failed to parse XML: StopNode is not closed.
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:01:13.191Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.07
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
====
REMINDERS
Below is your current list of reminders for this task. Keep them updated as you progress.
| # | Content | Status |
|---|---------|--------|
| 1 | Add updateFileSizes server action to src/actions/media.ts | Completed |
| 2 | Update src/app/dashboard/media/page.tsx to fetch and pass isAdmin prop | In Progress |
| 3 | Update src/app/dashboard/media/MediaToolbar.tsx to include Update Sizes button for admins | Pending |
| 4 | Update src/app/dashboard/media/MediaManager.tsx to handle update sizes state, handler, pass to toolbar, and show progress bar | Pending |
IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.
</environment_details>
---
**Assistant:**
<apply_diff>
<args>
<file>
<path>src/app/dashboard/media/page.tsx</path>
<diff>
<content><![CDATA[
<<<<<<< SEARCH
import { auth } from "@/lib/gel";
=======
import { auth, e } from "@/lib/gel";
>>>>>>> REPLACE
]]></
---
**User:**
[apply_diff for 'src/app/dashboard/media/page.tsx'] Result:
Failed to parse apply_diff XML. This usually means:
1. The XML structure is malformed or incomplete
2. Missing required <file>, <path>, or <diff> tags
3. Invalid characters or encoding in the XML
Expected structure:
<args>
<file>
<path>relative/path/to/file.ext</path>
<diff>
<content>diff content here</content>
<start_line>line number</start_line>
</diff>
</file>
</args>
Original error: Failed to parse XML: content is not closed
<environment_details>
# VSCode Visible Files
[...REDACTED...]
# VSCode Open Tabs
[...REDACTED...]
# Current Time
Current time in ISO 8601 UTC format: 2025-11-28T22:01:17.527Z
User time zone: Europe/Amsterdam, UTC+1:00
# Current Cost
$0.08
# Current Mode
<slug>code</slug>
<name>Code</name>
<model>grok-4-1-fast-reasoning</model>
====
REMINDERS
Below is your current list of reminders for this task. Keep them updated as you progress.
| # | Content | Status |
|---|---------|--------|
| 1 | Add updateFileSizes server action to src/actions/media.ts | Completed |
| 2 | Update src/app/dashboard/media/page.tsx to fetch and pass isAdmin prop | In Progress |
| 3 | Update src/app/dashboard/media/MediaToolbar.tsx to include Update Sizes button for admins | Pending |
| 4 | Update src/app/dashboard/media/MediaManager.tsx to handle update sizes state, handler, pass to toolbar, and show progress bar | Pending |
IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.
</environment_details>
---
**Assistant:**
<apply_diff>
<args>
<file>
<path>src/app/dashboard/media/page.tsx
---
**User:**
[apply_diff] Result:
The tool execution failed with the following error:
<error>
Missing value for required parameter 'args (must contain at least one valid file element)'. Please retry with complete response.
# Reminder: Instructions for Tool Use
Tool uses are formatted using XML-style tags. The tool name itself becomes the XML tag name. Each parameter is enclosed within its own set of tags. Here's the structure:
<actual_tool_name>
<parameter1_name>value1</parameter1_name>
<parameter2_name>value2</parameter2_name>
...
</actual_tool_name>
For example, to use the attempt_completion tool:
<attempt_completion>
<result>
I have completed the task...
</result>
</attempt_completion>
Always use the actual tool name as the XML tag name for proper parsing and execution.
</error>
...
EDIT: It seems that when enabling https://kilo.ai/docs/features/experimental/native-function-calling and updating to 1.125.1 (priliminairy for me) resulted no more editing errors occurring!
You can set it in the Providers tab of Kilo Code settings and open the Advanced settings section of any Grok model, specifically Tool Call Style, where JSON means "native" 🤓