Fix ContentModified errors in info view while typing#679
Merged
mhuisi merged 1 commit intoleanprover:masterfrom Oct 13, 2025
Merged
Fix ContentModified errors in info view while typing#679mhuisi merged 1 commit intoleanprover:masterfrom
mhuisi merged 1 commit intoleanprover:masterfrom
Conversation
brandondong
commented
Oct 12, 2025
| // to the RPC sessions. Try again. | ||
| setUpdaterTick(t => t + 1) | ||
| reject('retry') | ||
| return |
Contributor
Author
There was a problem hiding this comment.
Before debugging, my first guess was the bug was due to a lack of return here. It will call reject but then there's nothing stopping the code from continuing further down and calling resolve.
It turns out Promise's just return the value of the first resolve/reject that you call if you decide to call more than one, TIL. Anyways, I just added an explicit return here. Not doing so will result in purely wasted work executing the logic below only for Promise to take the first result.
Collaborator
|
Thanks! Good diagnosis :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue:
While typing up longer proofs, I frequently see an error in the info view:
Error updating: Error fetching goals: Rpc error: ContentModified: File changed.(maybe it happens to me frequently because my computer is on the older side).It's super annoying because all the usual premise/goal info in the view is temporarily cleared to display the error and I need to wait for Lean to finish its processing before the info appears again.
Here's a video with me making contrived edits to demonstrate the issue:
https://github.com/user-attachments/assets/a077a113-7821-44bc-a307-40c0b3d37bb4
I checked the code and there should already be logic in place to not clear the info view for this particular rpc error:

Root cause:
Debugging, the original rpc error is being thrown from Widget_getWidgets

However, it's being handled by
discardMethodNotFoundwhich for this type of error, will callmapRpcError. This will convert the original rpc error with its code information into an opaqueErrortype. This bypasses the aforementionedRpcErrorCode.ContentModifiedcheck and we end up resolving with the error string incorrectly.Fix:
discardMethodNotFoundto just rethrow the original exception when it's not the special case ofRpcErrorCode.MethodNotFoundwhich it's specifically written to handle.discardMethodNotFoundis not used anywhere else.