Agent Review sometimes fails with ‘Failed to gather context’ error

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Sometimes I’m unable to use the Agent Review feature in Cursor. When I click “Find Issues” in the Source Control panel, the Output panel shows the following error:

2025-11-28 11:08:49.441 [info] Computing local context for repository at 'xxx'
2025-11-28 11:08:49.490 [error] Error computing local context: Error: Failed to gather Agent Review context.

Caused by:
    Error when executing 'git':

The error message ends with a colon but shows no further details after it.

The Review Changes function inside the Agent chat still works, but only for the changes that Agent made this time. Reviewing the changes for the current diff from main branch of the repository triggers this error.

This issue only happens in some of my Git repositories, and I’m not sure what specific condition is causing it.

Steps to Reproduce

Click Find Issues from Source Control panel, or Open Agent's Changes, then Find Issues with Review Diff with Main Branch option.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.39
VSCode Version: 1.105.1
Commit: 60d42bed27e5775c43ec0428d8c653c49e58e260
Date: 2025-11-27T02:30:49.286Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the report! I found a very similar issue from another user where the complete error shows: Error when executing 'git': fatal: Not a valid object name origin

This seems to be related to git branch references in the Agent Review feature. To help investigate, could you please share:

  1. The complete error message from the Output panel (the part after the colon)
  2. Your current git branch and whether you have a main branch (or master) both locally and on the remote
  3. Run git branch -a in your terminal and share the output

Workaround: As you noted, the “Review Changes” function inside Agent chat should work for reviewing Agent’s own changes.

This looks like it may need engineering attention. I’ve linked your report with a similar one here: Agent review GIT issue

Hi, thanks for the follow-up!

As I mentioned in my original report, there is actually no output after the colon. If I click “Find Issues” multiple times in a row, the logs look like this:

2025-11-28 14:12:45.969 [info] Computing local context for repository at 'xxx'
2025-11-28 14:12:46.002 [error] Error computing local context: Error: Failed to gather Agent Review context.

Caused by:
    Error when executing 'git': 
2025-11-28 14:12:46.744 [info] Computing local context for repository at 'xxx'
2025-11-28 14:12:46.812 [error] Error computing local context: Error: Failed to gather Agent Review context.

Caused by:
    Error when executing 'git': 
2025-11-28 14:12:47.033 [info] Computing local context for repository at 'xxx'
2025-11-28 14:12:47.072 [error] Error computing local context: Error: Failed to gather Agent Review context.

Caused by:
    Error when executing 'git': 

So this might be slightly different from the similar issue you referenced, since the error message ends with a colon and never shows any additional output.

Here’s the result of running git branch -a:

* yyw
  remotes/origin/HEAD -> origin/main
  remotes/origin/main
  remotes/origin/master
  remotes/origin/prod
  remotes/origin/test
  remotes/origin/yyw
(END)

It’s a bit messy, but I’m currently working on the yyw branch, and that should be the only branch I have locally.

Sorry, I guess I didn’t click reply… Please check my previous message. Thanks!

Thanks for the detailed info! This is helpful. The empty error message after the colon suggests the git command itself is failing silently, which is different from the typical output.

Given your git setup with both origin/main and origin/master branches, this might be confusing Agent Review’s branch detection logic.

I’ve escalated this to the engineering team along with the similar report. The Agent Review feature is quite new and still being refined, so bugs like this are being actively addressed.

In the meantime, the “Review Changes” function inside Agent chat should continue to work for reviewing Agent’s generated changes. Your other Cursor features should work normally.

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.