From c57008d77e940ea235822c02351020de34fa97a6 Mon Sep 17 00:00:00 2001 From: branchseer Date: Sun, 11 Jan 2026 09:01:04 -0800 Subject: [PATCH 1/2] fix: handle Windows path stripping failures gracefully On Windows, path stripping may fail due to case sensitivity or path format differences between the tracked access path and workspace root. Previously this caused an error like: "Invalid relative path 'D:\a\...\project': path is not relative" This change treats such paths as outside the workspace (returning None) rather than failing, which is consistent with how we handle paths that don't match the workspace prefix. Co-Authored-By: Claude Opus 4.5 --- crates/vite_task/src/session/execute/spawn.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/crates/vite_task/src/session/execute/spawn.rs b/crates/vite_task/src/session/execute/spawn.rs index 2f7aaa8e..6e58b3a0 100644 --- a/crates/vite_task/src/session/execute/spawn.rs +++ b/crates/vite_task/src/session/execute/spawn.rs @@ -174,17 +174,14 @@ where let path_writes = &mut track_result.path_writes; for access in termination.path_accesses.iter() { - let relative_path = access - .path - .strip_path_prefix(workspace_root, |strip_result| { - let Ok(stripped_path) = strip_result else { - return None; - }; - Some(RelativePathBuf::new(stripped_path).map_err(|err| { - anyhow::anyhow!("Invalid relative path '{}': {}", stripped_path.display(), err) - })) - }) - .transpose()?; + let relative_path = access.path.strip_path_prefix(workspace_root, |strip_result| { + let Ok(stripped_path) = strip_result else { + return None; + }; + // On Windows, path stripping may fail due to case sensitivity or path format + // differences. Treat these as outside workspace rather than failing. + RelativePathBuf::new(stripped_path).ok() + }); let Some(relative_path) = relative_path else { // Ignore accesses outside the workspace From c645ad1ffd881cd26952c3e021d08e79f8872b8c Mon Sep 17 00:00:00 2001 From: branchseer Date: Tue, 13 Jan 2026 17:07:50 +0800 Subject: [PATCH 2/2] update comment --- crates/vite_task/src/session/execute/spawn.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/vite_task/src/session/execute/spawn.rs b/crates/vite_task/src/session/execute/spawn.rs index 6e58b3a0..6cf24019 100644 --- a/crates/vite_task/src/session/execute/spawn.rs +++ b/crates/vite_task/src/session/execute/spawn.rs @@ -178,8 +178,9 @@ where let Ok(stripped_path) = strip_result else { return None; }; - // On Windows, path stripping may fail due to case sensitivity or path format - // differences. Treat these as outside workspace rather than failing. + // On Windows, paths are possible to be still absolute after stripping the workspace root. + // For example: c:\workspace\subdir\c:\workspace\subdir + // Just ignore those accesses. RelativePathBuf::new(stripped_path).ok() });