BigPizzaV3/CodexPlusPlus · error
Codex CLI 路径不存在: 请填 Codex CLI 可执行文件的完整路径。macOS 桌面版通常在…
Error message
Codex CLI 路径不存在:{executable}
请填 Codex CLI 可执行文件的完整路径。macOS 桌面版通常在 /Applications/ChatGPT.app/Contents/Resources/codex;npm 全局安装可用 `which codex` / `where codex` 查看。 What it means
validate_codex_executable pre-flights the configured Codex CLI location before spawning the app-server. When the configured executable string looks like a path (contains / or \ or is absolute) but no file exists at that location, the library throws this error with platform-specific hints. It exists so users see a precise, actionable message instead of a generic spawn failure.
Solutions
- Verify the path with `ls <path>` and correct it to the real binary location
- Find the binary: `which codex` (macOS/Linux) or `where codex` (Windows) for npm installs; macOS desktop app bundles it at /Applications/ChatGPT.app/Contents/Resources/codex
- If you meant to use PATH lookup, clear the field or set it to just `codex` (no separators)
Example fix
// before
AppServerConfig { executable: "/usr/local/bin/codex-cli".into(), .. }
// after
AppServerConfig { executable: "codex".into(), .. } // resolved via PATH, verified with `which codex` Defensive patterns
Strategy: validation
Validate before calling
use std::path::Path;
fn executable_path_ok(executable: &str) -> bool {
let looks_like_path = executable.contains('/') || executable.contains('\\') || Path::new(executable).is_absolute();
!looks_like_path || Path::new(executable).exists()
} Try / catch
match CodexAppServer::start(config).await {
Err(e) if e.to_string().contains("路径不存在") => {
eprintln!("Fix the executable path; run `which codex` or use the macOS app bundle path");
// surface a settings UI instead of retrying
}
r => r?,
} Prevention
- Store the result of `which codex` / `where codex` in config rather than hand-typing paths
- After Codex app updates or node version switches, re-verify the path
- Prefer bare `codex` (PATH lookup) when the binary is on PATH
- Add a settings pre-check that lstat's the path before saving it
When it happens
Trigger: Passing AppServerConfig with an executable field containing a path separator whose file does not exist on disk, then calling CodexAppServer::start. Bare command names like "codex" skip this check (resolved via PATH) and fail later in spawn if missing.
Common situations: Typed a macOS desktop path (/Applications/ChatGPT.app/Contents/Resources/codex) on Linux, app moved or updated between versions, npm global install location changed after node version switch, typo in the path, trailing filename wrong (codex.exe vs codex).
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Codex CLI 路径指向的是目录而不是可执行文件:
- 请填写 API 的模型名称
- Backups must be outside the cache
- Codex CLI 没有执行权限:
- Dream Skin image is empty
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/a6c0f08ab928514f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/connect/app_server.rs:70
}
/// 启动前先把「路径本身就不对」的情况挑出来。
///
/// 之前不管什么原因失败,用户只会看到一句「请检查 Codex CLI 路径」——填的是目录、
/// 文件不存在、没有执行权限、甚至 app-server 协议不兼容,全都是这一句,
/// 于是 #1879 下面积了十几条「到底该填什么路径」。
///
/// 裸命令名(codex)交给 PATH 解析,这里只校验看起来像路径的输入。
fn validate_codex_executable(executable: &str) -> anyhow::Result<()> {
let looks_like_path = executable.contains('/')
|| executable.contains('\\')
|| Path::new(executable).is_absolute();
if !looks_like_path {
return Ok(());
}
let path = Path::new(executable);
if !path.exists() {
bail!(
"Codex CLI 路径不存在:{executable}\n请填 Codex CLI 可执行文件的完整路径。\
macOS 桌面版通常在 /Applications/ChatGPT.app/Contents/Resources/codex;\
npm 全局安装可用 `which codex` / `where codex` 查看。"
);
}
if path.is_dir() {
bail!(
"Codex CLI 路径指向的是目录而不是可执行文件:{executable}\n\
请去掉结尾的路径分隔符,或补上具体的可执行文件名。"
);
}
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
if let Ok(metadata) = std::fs::metadata(path)
&& metadata.permissions().mode() & 0o111 == 0
{
bail!("Codex CLI 没有执行权限:{executable}");View on GitHub (pinned to b1ed92e5e4)