From 3bb4c3d408a0de4f40262df06089fee572523696 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:37:58 -0400 Subject: [PATCH] Change response for missing content parameter to suggest claude to break file down into smaller files --- src/ClaudeDev.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ClaudeDev.ts b/src/ClaudeDev.ts index a4a9b9e..c0991c7 100644 --- a/src/ClaudeDev.ts +++ b/src/ClaudeDev.ts @@ -733,7 +733,14 @@ export class ClaudeDev { } if (newContent === undefined) { this.consecutiveMistakeCount++ - return await this.sayAndCreateMissingParamError("write_to_file", "content", relPath) + // Custom error message for this particular case + await this.say( + "error", + `Claude tried to use write_to_file for '${relPath}' without value for required parameter 'content'. This is likely due to reaching the maximum output token limit. Retrying with suggestion to change response size...` + ) + return await this.formatToolError( + `Missing value for required parameter 'content'. This may occur if the file is too large, exceeding output limits. Consider splitting into smaller files or reducing content size. Please retry with all required parameters.` + ) } this.consecutiveMistakeCount = 0 try {