biomejs/biome · error

Absolute path must be correctly parsed

Error message

Absolute path must be correctly parsed

What it means

Error "Absolute path must be correctly parsed" thrown in biomejs/biome.

Source

Thrown at crates/biome_fs/src/fs/os.rs:205

    fn from_rayon<'a>(scope: &'a Scope<'scope>) -> &'a Self {
        // SAFETY: transmuting from Scope to OsTraversalScope is safe since
        // OsTraversalScope has the `repr(transparent)` attribute that
        // guarantees its layout is the same as Scope
        unsafe { mem::transmute(scope) }
    }
}

impl<'scope> TraversalScope<'scope> for OsTraversalScope<'scope> {
    fn evaluate(&self, ctx: &'scope dyn TraversalContext, path: Utf8PathBuf) {
        // Path must be absolute in order to properly normalize them before matching against globs.
        //
        // FIXME: This code should be moved to the `traverse_inputs` function in `biome_cli/src/traverse.rs`.
        // Unfortunately moving this code to the `traverse_inputs` function makes many tests fail.
        // The issue is coming from some bugs in our test infra.
        // See https://github.com/biomejs/biome/pull/5017
        let path = match std::path::Path::new(&path).absolutize() {
            Ok(std::borrow::Cow::Owned(absolutized)) => Utf8PathBuf::from_path_buf(absolutized)
                .expect("Absolute path must be correctly parsed"),
            _ => path,
        };
        let file_type = match path.metadata() {
            Ok(meta) => meta.file_type(),
            Err(err) => {
                ctx.push_diagnostic(IoError::from(err).with_file_path(path.to_string()));
                return;
            }
        };
        handle_any_file(&self.scope, ctx, path, file_type, None);
    }

    fn handle(&self, context: &'scope dyn TraversalContext, path: Utf8PathBuf) {
        self.scope.spawn(move |_| {
            context.handle_path(BiomePath::new(path));
        });
    }
}

View on GitHub (pinned to 405dedb0ff)

Solutions

  1. Verify the path is absolute and well-formed before canonicalization.
  2. This indicates an internal invariant failure; report it with the offending path if reachable from user input.

Example fix

assert!(path.is_absolute()); let parsed = Utf8PathBuf::from_path_buf(path).map_err(|_| ...)?;

When it happens

Trigger: Thrown at crates/biome_fs/src/fs/os.rs:205 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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