zed-industries/zed · error

{working_dir:?} is not a valid URI

Error message

{working_dir:?} is not a valid URI

What it means

Setup guard in lsp::Client::new: the resolved working directory (root_path, or its parent when root_path is not a directory) could not be converted into a valid URI, so the language server process cannot be started with a workspace root.

Source

Thrown at crates/lsp/src/lsp.rs:530

    /// Starts a language server process.
    /// A request_timeout of zero or Duration::MAX indicates an indefinite timeout.
    pub fn new(
        stderr_capture: Arc<Mutex<Option<String>>>,
        server_id: LanguageServerId,
        server_name: LanguageServerName,
        binary: LanguageServerBinary,
        root_path: &Path,
        code_action_kinds: Option<Vec<CodeActionKind>>,
        workspace_folders: Option<Arc<Mutex<BTreeSet<Uri>>>>,
        cx: &mut AsyncApp,
    ) -> Result<Self> {
        let working_dir = if root_path.is_dir() {
            root_path
        } else {
            root_path.parent().unwrap_or_else(|| Path::new("/"))
        };
        let root_uri = Uri::from_file_path(&working_dir)
            .map_err(|()| anyhow!("{working_dir:?} is not a valid URI"))?;
        log::info!(
            "starting language server process. binary path: \
            {:?}, working directory: {:?}, args: {:?}",
            binary.path,
            working_dir,
            binary.arguments
        );
        let mut command = util::command::new_command(&binary.path);
        command
            .current_dir(working_dir)
            .args(&binary.arguments)
            .envs(binary.env.clone().unwrap_or_default())
            .stdin(Stdio::piped())
            .stdout(Stdio::piped())
            .stderr(Stdio::piped())
            .kill_on_drop(true);

        let mut server = command

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Open the project from a valid local directory path
  2. Check for unusual characters/encodings in the project path
  3. Report if a valid path is rejected (path-to-Url conversion bug)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/lsp/src/lsp.rs:445 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/5456ca5b7ed42353. Report an issue: GitHub.