Codex Desktop on Windows repeatedly launches IntelliJ IDEA from project path click and triggers JetBrains DirectoryLock error
What version of the Codex App are you using (From “About Codex” dialog)?
26.513.40821
What subscription do you have?
pro
What platform is your computer?
_No response_
What issue are you seeing?
Environment:
- OS: Windows
- Codex Desktop: 26.513.40821
- Codex CLI/runtime: 0.131.0-alpha.9
- IntelliJ IDEA: 2025.3
- IDEA path: D:\IntelliJ IDEA 2025.3\bin\idea64.exe
- Project path: D:\workspace\xuanwu-contract-sign
Steps to reproduce:
- Open Codex Desktop on Windows.
- Configure/open target for the project path to IntelliJ IDEA.
- Click the project directory/path address in Codex.
- IDEA opens successfully if it is not already running.
- Click the same project directory/path address again while IDEA is already running.
Actual result:
Codex launches idea64.exe again and IntelliJ IDEA shows an internal error:
com.intellij.platform.ide.bootstrap.DirectoryLock$CannotActivateException:
Process "D:\IntelliJ IDEA 2025.3\bin\idea64.exe" is still running and does not respond.
Suppressed exceptions include:
java.net.SocketException: Invalid argument: bind
java.net.SocketException: Invalid argument: connect
Expected result:
If IntelliJ IDEA is already running for that project, Codex should either:
- activate/focus the existing IDEA window,
- use JetBrains Toolbox/IDE protocol safely,
- or avoid launching a second IDEA process from the project path click.
Additional findings:
- The IDEA process is alive and responding.
- Running
Start-Process "D:\IntelliJ IDEA 2025.3\bin\idea64.exe" "D:\workspace\xuanwu-contract-sign"twice from PowerShell did not reproduce the issue. - Simulating Node spawn with the same executable/path also worked.
- The issue appears specific to Codex Desktop's project path click/open-target flow or persisted open target state.
- Codex persisted state contains:
"open-in-target-preferences": {"global":"intellij","perPath":{"D:\\workspace\\xuanwu-contract-sign":"intellij"}}
- Changing the persisted JSON to fileManager can be overwritten by the running Codex app on exit/restart.
Impact:
Repeatedly clicking the project directory address in Codex causes a scary IntelliJ internal error and makes the Codex directory link unreliable when IntelliJ is selected as the open target.
What steps can reproduce the bug?
Codex Windows 客户端点击项目目录地址会重复启动 IDEA,而不是激活已有 IDEA,导致 IDEA 2025.3 报 DirectoryLock$CannotActivateException。这是 Codex 打开目标逻辑和 JetBrains 单实例机制的兼容问题。
What is the expected behavior?
_No response_
Additional information
_No response_
2 Comments
I dug into the current open-source repo to narrow the likely scope of this bug.
What I found:
file_opener, described as a URI-based file opener for clickable file citations.UriBasedFileOpenerare only:vscodevscode-insiderswindsurfcursornonedesktop.open-in-target-preferences,Open in IDEA,intellij, oridea64references in the open-source repo.Relevant code pointers:
codex-rs/config/src/types.rs(UriBasedFileOpener)codex-rs/config/src/config_toml.rs(file_opener)codex-rs/core/src/config/mod.rs(defaultingfile_openertoVsCode)That makes me suspect this Windows "Open in IDEA" behavior is either:
Separately, I can still reproduce the user-visible failure pattern:
DirectoryLock$CannotActivateExceptioninstead of reusing/focusing the existing instanceIf helpful, I can continue from here and post either:
If this aligns with the team’s intended direction, would you be open to an invited PR for this issue?
这个方法可以解决(this url can solve thie problem)
https://github.com/openai/codex/issues/13937#issuecomment-4843425233