# Objective Currently, when a model provides the wrong parameters to the edit file tool, it gets back the opaque error message `data did not match any variant of untagged enum ValueOrJsonString`. At least some models (DeepSeek in my experience) can't figure out what to do from this point, and keep trying the same wrong parameter names in the tool call before eventually falling back to using `ed`. This may address https://github.com/zed-industries/zed/issues/58622. ## Solution Rather than attempting to deserialize to the `ValueOrJsonString` enum, try to deserialize as a JSON string and then as a value in turn, so that deserialization errors better propagate. ## Testing Using DeepSeek V4 Pro. Tried it out in a reloaded conversation where the edit tool was consistently failing. Asked it to stress-test the edit tool. Only one edit failed after a few successful attempts, and returned the error message "missing field `new_text`". Subsequent edits worked again rather than resulting in a doom loop. I don't think the model noticed what happened, but it seemed to help. <img width="366" height="551" alt="image" src="https://github.com/user-attachments/assets/6f9c0c8d-bf94-4670-bad0-0ead5c1fff4e" /> ... <img width="346" height="153" alt="image" src="https://github.com/user-attachments/assets/2afa2901-9a90-4142-aa9d-ff32a7be0d0c" /> --- Release Notes: - Improved edit_file tool error messaging. --------- Co-authored-by: MrSubidubi <finn@zed.dev>
2 files changedLine totals unavailable