edit_file tool fails when exact text match not found due to whitespace differences
Describe the bug The edit_file tool throws "Could not find exact match for edit" error when the oldText parameter doesn't exactly match the file content, typically due to whitespace, line ending, or formatting differences between expected and actual text. To Reproduce Steps to reproduce the behavior:
Use edit_file with oldText parameter containing text that differs in whitespace from actual file content Tool attempts to find exact match in file Error occurs: "Could not find exact match for edit" Edit operation fails completely
Expected behavior The edit_file tool should either handle minor whitespace differences or provide clear guidance on exact text matching requirements. Alternative: tool should show snippet of actual file content around failed match location. Logs Error: Could not find exact match for edit: [oldText content that failed to match] Additional context This occurs frequently when working with code files where whitespace, indentation, or line endings may vary. The tool requires perfect character-by-character matching including all whitespace. Recommendation: always use read_file before edit_file to ensure exact text matching.