biomejs/biome · error

To have a UTF-8 path

Error message

To have a UTF-8 path

What it means

Error "To have a UTF-8 path" thrown in biomejs/biome.

Source

Thrown at crates/biome_lsp/src/session.rs:904

        } else {
            *workspace_folders = Some(added);
        }
    }

    /// Returns the root URI of the workspace as provided by the client
    pub(crate) fn base_uri(&self) -> Option<Uri> {
        let initialize_params = self.initialize_params.get()?;
        initialize_params.root_uri.clone()
    }

    /// Returns the base path of the workspace on the filesystem if it has one
    pub(crate) fn base_path(&self) -> Option<Utf8PathBuf> {
        let initialize_params = self.initialize_params.get()?;

        let root_uri = initialize_params.root_uri.as_ref()?;
        match root_uri.to_file_path() {
            Some(base_path) => Some(
                Utf8PathBuf::from_path_buf(base_path.to_path_buf()).expect("To have a UTF-8 path"),
            ),
            None => {
                error!(
                    "The Workspace root URI {root_uri:?} could not be parsed as a filesystem path"
                );
                None
            }
        }
    }

    /// Returns a reference to the client information for this session
    pub(crate) fn client_information(&self) -> Option<&ClientInformation> {
        self.initialize_params.get()?.client_information.as_ref()
    }

    /// Mark that the initialized() notification has been received
    pub(crate) fn set_initialized(&self) {
        self.initialized.store(true, Ordering::Relaxed);

View on GitHub (pinned to 0fca643d22)

Solutions

  1. Ensure the URI received by the LSP server maps to a valid UTF-8 file path.
  2. Reject or normalize non-UTF-8 document URIs at the session boundary.

Example fix

let path = url_to_path(&uri).ok_or_else(|| /* invalid URI error */)?;

When it happens

Trigger: Thrown at crates/biome_lsp/src/session.rs:903 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of biomejs/biome@0fca643d22 (2026-08-20). Data as JSON: /api/errors/bc319f5a4d4840e9. Report an issue: GitHub.