claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

IntelliJ IDE opens Claude code terminal in .ijwb directory when Bazel for Intellij plugin is installed and running in a bazel project

Open ilanKeshet opened this issue 6 months ago • 5 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [x] AWS Bedrock
    • [ ] Google Vertex AI
    • [x] Other: Claude Code [Beta] IntelliJ plugin 0.1.11-beta
  • Claude CLI version: 1.0.67 (Claude Code)
  • Operating System: MacOS Sequoia 15.5
  • Terminal: InteliJ IDE Terminal - IntelliJ IDEA 2025.1.4.1 (Ultimate Edition)

Bug Description

When Bazel for Intellij plugin is installed (I have version 2025.07.24.0.1-api-version-251) When starting Claude code in the IDE terminal it starts of in the .ijwb directory instead of the project root directory. This is a problem as for example Claude code can't find it's license.

Steps to Reproduce

  1. install IntelliJ and install bazel plugin for IntelliJ
  2. Start a new bazel project
  3. Install Claude code and IntelliJ Claude Code [Beta] plugin
  4. Click the Anthropic icon to start Claude code in ide terminal
  5. note cwd is wrong

Expected Behavior

Claude code would open with cwd as project root

Actual Behavior

Claude code opens with cwd as .ijwb directory (which is the bazel plugin configuration directory)

Workaround

  1. Press ctrl+d twice to exit Claude code
  2. cd .. to navigate to actual project root
  3. Start Claude code again Claude

Additional Context

IntelliJ IDEA 2025.1.4.1 (Ultimate Edition)
Build #IU-251.27812.49, built on July 24, 2025
Source revision: 735cc3bd3c92f
Licensed to <Reducted> / Ilan Keshet
Subscription is active until November 6, 2025.
Runtime version: 21.0.7+9-b895.130 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.5
Kotlin plugin: K2 mode
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 8096M
Cores: 16
Metal Rendering is ON
Registry:
  ide.experimental.ui=true
  jvm.dfa.analysis.ui.security.analysis.window.was.shown=true
Non-Bundled Plugins:
  com.jetbrains.plugins.ini4idea (251.27812.54)
  com.ultrahob.zerolength.plugin (0.95)
  artsiomch.meson.syntax (203.1.0)
  org.jetbrains.plugins.go (251.27812.12)
  com.intellij.grazie.pro (0.3.388-251)
  info.fluffos.idea_bison (20230902.02)
  ir.msdehghan.plugins.ansible (1.0.0)
  name.kropp.intellij.makefile (251.25410.28)
  org.ermadan.kafkalytic (0.10.5)
  org.intellij.plugins.hcl (251.26927.39)
  PythonCore (251.27812.49)
  aws.toolkit.core (3.87.251)
  com.jetbrains.space (251.23774.318)
  org.jetbrains.plugins.ruby (251.27812.49)
  org.jetbrains.plugins.go-template (251.23774.318)
  fantom.codeowners (0.9.0)
  idea.goyacc (0.1.0)
  com.anthropic.code.plugin (0.1.11-beta)
  dev.meanmail.plugin.nginx-intellij-plugin (2025.14)
  Pythonid (251.27812.49)
  com.koxudaxi.pydantic (0.4.18)
  com.intellij.ml.llm (251.27812.49)
  net.seesharpsoft.intellij.plugins.csv (4.0.2)
  uk.co.ben-gibson.remote.repository.mapper (4.5.2)
  mobi.hsz.idea.gitignore (4.5.6)
  amazon.q (3.87.251)
  com.intellij.bigdatatools.core (251.27812.49)
  izhangzhihao.rainbow.brackets.lite (1.3.0)
  org.intellij.scala (2025.1.32)
  com.google.idea.bazel.ijwb (2025.07.24.0.1-api-version-251)
  com.github.copilot (1.5.52-243)
  aws.toolkit (3.87.251)
Kotlin: 251.27812.49-IJ
Image

ilanKeshet avatar Aug 04 '25 05:08 ilanKeshet

There may be a bigger issue with Intellij IDEA and not Claude Code plugin related to it.

There's similar problem with Bazel projects and a built-in MCP server: it refuses accessing any "real" project data because it thinks that the project root is $PRJ/.ijwb so if you ask it to refactor $PRJ/foo/Bar.java it refuses stating that it is "outside of the project directory".

kberezin-nshl avatar Aug 14 '25 11:08 kberezin-nshl

Same issue with jetbrains mcp. Submitted a ticket to jetbrains here: https://youtrack.jetbrains.com/issue/IDEA-377834/IntelliJ-MCP-Server-defaults-to-.ijwb-directory-when-running-in-a-bazel-project

fivetran-kevinzhao avatar Aug 19 '25 21:08 fivetran-kevinzhao

This is what Jetbrains told me to resolve the issue: the problem lies with the existence of the .ijwb directory created by the now deprecated "Bazel for IntelliJ" plugin. Jetbrains recommends downloading their new official Bazel plugin. Here are the steps:

  1. Uninstall the Bazel for IntelliJ plugin.
  2. Download the official Jetbrains Bazel plugin.
  3. Move your current repo (containing the .ijwb folder) to a different path ie) /old-repo
  4. Re-clone your repo, and use intelliJ to open that project. This should create the correct .bazelbsp directory and setup bazel for the project automatically using the new official plugin.
  5. Now both the MCP server plugin and the Claude code plugin will open to the correct project directory.

fivetran-kevinzhao avatar Aug 20 '25 18:08 fivetran-kevinzhao

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.

github-actions[bot] avatar Dec 04 '25 10:12 github-actions[bot]

It's true that jetbrains are in the process of rolling out a new bazel plugin, but at the moment it's far from a replacement to the existing deprecated plugin

On Thu, Dec 4, 2025, 12:19 github-actions[bot] @.***> wrote:

github-actions[bot] left a comment (anthropics/claude-code#5081) https://github.com/anthropics/claude-code/issues/5081#issuecomment-3611334662

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.

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/5081#issuecomment-3611334662, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNW4Y36MHUMPPTOXGXUGML4AADEBAVCNFSM6AAAAACDA7CYZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMJRGMZTINRWGI . You are receiving this because you authored the thread.Message ID: @.***>

ilanKeshet avatar Dec 04 '25 19:12 ilanKeshet