{"record":{"id":"e99bba071c9ab538","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-e99bba","errorCode":null,"errorMessage":"工作目录不存在：{}","messagePattern":"工作目录不存在：(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/connect/mod.rs","lineNumber":119,"sourceCode":"\npub type SharedWeixinConnectStatus = Arc<Mutex<WeixinConnectStatus>>;\n\npub async fn run_weixin_connect(\n    config: WeixinConnectConfig,\n    stop: Arc<AtomicBool>,\n    status: SharedWeixinConnectStatus,\n) -> anyhow::Result<()> {\n    let config = config.normalized();\n    if config.token.is_empty() {\n        bail!(\"请先扫码登录微信\");\n    }\n    let work_dir = if config.work_dir.is_empty() {\n        std::env::current_dir().context(\"无法读取当前工作目录\")?\n    } else {\n        PathBuf::from(&config.work_dir)\n    };\n    if !work_dir.is_dir() {\n        bail!(\"工作目录不存在：{}\", work_dir.display());\n    }\n\n    update_status(&status, |current| {\n        current.state = \"starting\".to_string();\n        current.message = \"正在连接微信和 Codex app-server...\".to_string();\n        current.account_id = config.account_id.clone();\n        current.has_token = true;\n    });\n\n    let client = WeixinClient::new(&config.base_url, &config.token, &config.route_tag)?;\n    let store = ConnectSessionStore::default_for_account(&config.account_id);\n    let mut state = store.load().unwrap_or_default();\n    let app_config = AppServerConfig {\n        executable: config.codex_path.clone(),\n        work_dir,\n        model: config.model.clone(),\n        sandbox: config.sandbox.clone(),\n    };","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/connect/mod.rs#L101-L137","documentation":"The working directory passed to the Codex app-server, config.work_dir or the process cwd when empty, does not exist as a directory, so the connector aborts before spawning anything. The app-server would otherwise run in a bogus cwd and fail later in worse ways.","triggerScenarios":"WeixinConnectConfig.work_dir points at a deleted or renamed directory; a relative path resolved against a different cwd; an unexpanded tilde or env var left in the saved path; empty work_dir while the daemon cwd itself was removed.","commonSituations":"Project moved or deleted after the profile was saved; service started from a different directory; the volume holding the directory is not mounted.","solutions":["Create the directory or point work_dir at an existing one","Store an absolute path and expand tilde or env vars before saving the profile","When work_dir is empty by design, start the process from a valid cwd","Fix typos in the saved profile path"],"exampleFix":"// before\nrun_weixin_connect(config, stop, status).await?;\n// after: validate or create the directory before starting\nlet dir = std::path::PathBuf::from(&config.work_dir);\nif !dir.is_dir() { std::fs::create_dir_all(&dir)?; }\nrun_weixin_connect(config, stop, status).await?;","handlingStrategy":"validation","validationCode":"let dir = std::path::Path::new(config.work_dir.trim());\nif config.work_dir.trim().is_empty() || !dir.is_dir() {\n    bail!(\"work dir missing: {}\", dir.display());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Expand tilde and env vars before saving work_dir","Use absolute paths in profiles","Create the directory with create_dir_all when it is owned by the app"],"tags":["config","filesystem","work-dir","weixin"],"backgroundTag":"working-directory-not-found","analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}