biomejs/biome · error

To have a valid UTF-8 path

Error message

To have a valid UTF-8 path

What it means

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

Source

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

    /// This function attempts to read the `biome.json` configuration file from
    /// the root URI and update the workspace settings accordingly
    #[tracing::instrument(level = "debug", skip(self))]
    pub(crate) async fn load_workspace_settings(self: &Arc<Self>, reload: bool) {
        if let Some(config_path) = self.resolve_configuration_path(None) {
            info!("Detected configuration path in the workspace settings.");
            let config_file_path = config_path.to_path_buf();
            let status = self
                .load_biome_configuration_file(config_path, reload)
                .await;
            debug!("Configuration status: {:?}", status);
            self.record_configuration_status(config_file_path.as_deref(), status);
        } else if let Some(folders) = self.get_workspace_folders() {
            info!("Detected workspace folder.");
            for folder in folders {
                info!("Attempt to load the configuration file in {:?}", folder.uri);
                let base_path = folder.uri.to_file_path().map(|p| {
                    Utf8PathBuf::from_path_buf(p.to_path_buf()).expect("To have a valid UTF-8 path")
                });
                match base_path {
                    Some(base_path) => {
                        let status = self
                            .load_biome_configuration_file(
                                ConfigurationPathHint::FromWorkspace(base_path.clone()),
                                reload,
                            )
                            .await;
                        debug!("Configuration status: {:?}", status);
                        self.record_configuration_status(Some(&base_path), status);
                    }
                    None => {
                        error!(
                            "The Workspace root URI {:?} could not be parsed as a filesystem path",
                            folder.uri
                        );
                    }

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:1033 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/1731ced5b1b9d818. Report an issue: GitHub.