2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PhpStorm AI Assistant(Codex)がWSL環境で CreateProcess error=267 になる問題の回避策

2
Posted at

発生した問題

Windows 11 + WSL環境で、WSL上のディレクトリに配置したプロジェクトをPhpStormで開き、AI Assistant(Codex)を実行しようとすると、以下のエラーが発生しました。

Failed to initialize ACP process.
... 
Cannot run program "...codex-acp-x64-windows.exe"
...
CreateProcess error=267, ディレクトリ名が無効です ...

プロジェクトは \\wsl.localhost\Ubuntu\home\... 経由で開いており、一見すると WSL対応として正しい構成に見えます。


原因

原因は Windows版 Codex 実行ファイルWSL(Linux)の作業ディレクトリ のミスマッチです。

  • Codex は Windows ネイティブ実行ファイル
    (codex-app-x64-windows.exe)
  • しかし起動時の Working Directory が /home/...(Linuxパス)のまま渡される
  • 結果として Java の CreateProcess\\home\\... のような無効なパスを解決できず失敗する

\\wsl.localhost でプロジェクトを開いていても、
内部的に Linuxパスがそのまま Windows プロセスに渡るケースがある
という点がポイントです。

この問題は以下の YouTrack Issue でも言及されていますが、私が見る限り具体的な解決策までは提示されていないようです……


回避策

WSLのディレクトリを Windows の「ネットワークドライブの割り当て」機能を使ってドライブレターに割り当て、そのドライブ配下のパスをプロジェクトルートとして指定しました。

ネットワークドライブ割り当て方法は以下の記事を参考にさせて頂きました。

WSLをネットワークドライブに割り当てて便利に使う方法 | ハングスタック
https://hangstuck.com/wsl-network-dirve/

例:

  • WSL 側のパス
    /home/username/repositories/my-project
  • ネットワークドライブ割り当て後
    Z:\home\username\repositories\my-project

この Z:\... を PhpStorm で開いたところ、Codex は正常に起動・動作しました。

最後に

公式 Issue では明確な対処方法が書かれていなかったため、同様の環境で詰まった人の参考になればと思い、記録として残しました。

本記事は暫定的な回避策であり、将来的に PhpStorm / AI Assistant 側で正式対応される可能性があります。

2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?