[BUG] `ide:getDiagnostics` times out if file is not active in Jetbrains IDE

Status Closed — not planned
Maintainer reply ✓ Yes — hackyon-anthropic
Activity 15 comments · opened Jul 6, 2025 · closed Feb 6, 2026
💡 Likely answer: A maintainer (hackyon-anthropic, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [X] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.30 (Claude Code)
  • Operating System: 6.12.34 1-NixOS
  • Terminal: Alacritty

Bug Description

When claude attempts to call the ide:getDiagnostics MCP after connecting with /ide and the file it is requesting information for is not the file, that is the currently selected file, the tool times out with Timeout getting diagnostics.

Steps to Reproduce

  1. Open a Jetbrains IDE with Claude Code installed
  2. Connect with /ide
  3. Ask Claude to get diagnostic information about file xyz
  4. Watch it time out
  5. Open file xyz in the IDE and ask Claude again
  6. Watch it retrieve the information successfully

Expected Behavior

Diagnostics retrieval should not depend on the file being the actively selected file in the IDE.

Actual Behavior

Diagnostics retrieval only works when the file for which the information is being retrieved is open and selected.

View original on GitHub ↗

15 Comments

hackyon-anthropic collaborator · 1 year ago

Thanks for the report!

Unfortunately, last I checked, there were limitations to the JetBrains IDE API, where the relevant diagnostics can only be retrieved for the visible files. I can take another look to see if they've opened up the API since I last checked (or if there are any other ways around it)!

Janrupf · 1 year ago

If its not possible to retrieve the diagnostics, a better error message would be nice. The official Jetbrains MCP has a method for retrieving project wide diagnostics even when the files are not open, but I think the limitations regarding diagnostics only for open files apply there too when attempting to retrieve file specific diagnostics

LaP0573 · 1 year ago

Interested in this as well, it's pretty unwieldy having to manually open every single file to let claude check the warnings/errors.

Ixe1 · 1 year ago

Also interested, hope there's a solution to this in the near future.

iSuslov · 1 year ago

Solution would be to create a hook. For example (WebStorm on MacOS):

{
// .claude/settings.local.json
// ...
"hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__ide__getDiagnostics",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.uri' | xargs -r open -a \"WebStorm.app\""
          }
        ]
      }
    ]
  }
}

This way it will open a file in your IDE before executing the tool.

lucastrahlendorff · 9 months ago

Thank you @iSuslov. In my case, when using Linux, I had to adjust the path and add a delay after opening the file:

"hooks": {
  "PreToolUse": [
    {
      "matcher": "mcp__ide__getDiagnostics",
      "hooks": [
        {
          "type": "command",
          "command": "jq -r '.tool_input.uri' | sed 's|^file://||' | xargs -r <YOUR_IDE_EXECUTABLE> && sleep 0.5"
        }
      ]
    }
  ]
}

Maybe this helps someone.

sddavis · 9 months ago

Thanks for that workaround. For Windows (using cmd as the shell), it was more complicated to get it working. In addition to the hook:

  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__ide__getDiagnostics",
        "hooks": [
          {
            "type": "command",
            "command": "\"C:\\Program Files\\Git\\usr\\bin\\bash.exe\" -c \"/usr/bin/jq -r '.tool_input.uri' | /usr/bin/sed 's#^file://##' | /usr/bin/xargs -r -I {} \\\"C:\\Program Files\\JetBrains\\IntelliJ IDEA 2025.2.2\\bin\\idea64.exe\\\" '{}'\""
          }
        ]
      }
    ]
  }

I had to add the following to Claude.md:

- When running mcp__ide__getDiagnostics, if it fails with a time out, try it a second time.
- When running mcp__ide__getDiagnostics, always use forward slashes in the file path.

The first call to the tool opens the file but still times out if the file wasn't already open, but then Claude tries again and it works. A 5s sleep is not enough to make the first call work.

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

NIPSEN · 8 months ago

Thanks for the workaround for mcp__ide__getDiagnostics timeout issue

I needed to adapt the workaround for my setup, if it can help !

Add this to your ~/.claude/settings.json :

  {
    "hooks": {
      "PreToolUse": [
        {
          "matcher": "mcp__ide__getDiagnostics",
          "hooks": [
            {
              "type": "command",
              "command": "node -e \"require('child_process').spawn('C:/Program Files/Android/Android Studio/bin/studio64.exe', [JSON.parse(require('fs').readFileSync(0, 'utf8')).tool_input.uri.replace(/^file:\\/\\/\\//, '')], {detached: true, stdio: 'ignore'}).unref();\""
            }
          ]
        }
      ]
    }
  }

Key points:

  • Uses forward slashes (C:/Program Files/...) instead of backslashes - this is critical on Windows
  • The hook receives JSON via stdin containing the file URI
  • Strips the file:/// prefix to get the actual file path
  • Spawns Android Studio with detached: true and unref() to avoid blocking

For other IDEs, replace studio64.exe with your IDE's executable:

  • VS Code: Code.exe
  • IntelliJ IDEA: idea64.exe
  • etc.

This works perfectly - the file opens automatically in the IDE before diagnostics are retrieved, eliminating the timeout issue.

tangi-vass · 7 months ago

I found the real issue and fix.
getDiagnostics was the only tool provided by the old MCP Proxy, no more supported.
Now We should use the built-in MCP Server (https://www.jetbrains.com/help/idea/mcp-server.html) which provides 21 tools. The new equivalent is get_file_problems.

hackyon-anthropic collaborator · 7 months ago

Yea, unfortunately it times out, but it shouldn't block the execution (might delay it slightly). JetBrains only returns diagnostics if the file is active in the editor

We also have support for integrating LSPs using hooks as well, so you could use that to get around limitations of the JetBrains API.

github-actions[bot] · 6 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 6 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.