Fix file-scoped comments failing with "Error: File has been deleted"#8664
Draft
Fix file-scoped comments failing with "Error: File has been deleted"#8664
Conversation
Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/2e5f5355-cccd-4ac6-b866-9d00dcd8b8b4 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
When creating a file-scoped comment (range is undefined), the createReviewThread method was passing `line: 0` to the GitHub GraphQL API. The API does not accept line 0 and returns a null thread, which caused the misleading "File has been deleted" error. Fix: pass endLine directly (undefined for file-scoped comments) instead of converting undefined to 0. The line parameter is not required when subjectType is FILE. Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/2e5f5355-cccd-4ac6-b866-9d00dcd8b8b4 Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bug with file-scoped comment submission
Fix file-scoped comments failing with "Error: File has been deleted"
Apr 14, 2026
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.
File-scoped comments (via the comment button at the top of a file tab) fail with
Creating comment failed: Error: File has been deleted.on modified files.Cause
In
createReviewThread, whenendLineisundefined(file-scoped comment), the GraphQL mutation variable was set toline: 0:The GitHub API rejects
line: 0and returns a null thread, which hits the null-check that throws the misleading "File has been deleted" error. Thelineparameter is not required whensubjectTypeisFILE.Fix
src/github/pullRequestModel.ts: PassendLinedirectly instead of convertingundefinedto0src/test/view/reviewCommentController.test.ts: Add test for file-scoped comment creation verifyingline: undefinedandsubjectType: 'FILE'in the mutation