{"record":{"id":"224727a99b27fd18","repo":"zed-industries/zed","slug":"working-directory-cannot-be-empty","errorCode":null,"errorMessage":"Working directory cannot be empty","messagePattern":"Working directory cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_servers/src/acp.rs","lineNumber":1510,"sourceCode":"        self,\n        session_id: acp::SessionId,\n        mcp_servers: Vec<acp::McpServer>,\n    ) -> acp::ResumeSessionRequest {\n        acp::ResumeSessionRequest::new(session_id, self.cwd)\n            .additional_directories(self.additional_directories)\n            .mcp_servers(mcp_servers)\n    }\n}\n\nfn session_directories_from_work_dirs(\n    work_dirs: &PathList,\n    supports_additional_directories: bool,\n) -> Result<SessionDirectories> {\n    let mut ordered_paths = work_dirs.ordered_paths();\n    let cwd = ordered_paths\n        .next()\n        .cloned()\n        .ok_or_else(|| anyhow!(\"Working directory cannot be empty\"))?;\n    let additional_directories = if supports_additional_directories {\n        ordered_paths.cloned().collect()\n    } else {\n        Vec::new()\n    };\n\n    Ok(SessionDirectories {\n        cwd,\n        additional_directories,\n    })\n}\n\nfn work_dirs_from_session_info(cwd: PathBuf, additional_directories: Vec<PathBuf>) -> PathList {\n    let mut seen_paths = HashSet::default();\n    let mut paths = Vec::with_capacity(1 + additional_directories.len());\n\n    seen_paths.insert(cwd.clone());\n    paths.push(cwd);","sourceCodeStart":1492,"sourceCodeEnd":1528,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/agent_servers/src/acp.rs#L1492-L1528","documentation":"Raised by session_directories_from_work_dirs when constructing session request parameters: the ordered list of working directories produced no first element, so there is no current working directory to send to the agent server. This indicates the PathList for the session was empty, which is a caller/state bug rather than a user input error.","triggerScenarios":"Thrown at crates/agent_servers/src/acp.rs:1481 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the session is created with at least one working directory","Pass the workspace's first worktree root as the cwd when constructing session requests"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}