sinelaw/fresh · error · io::Error
NotFound
NotFound
Error message
Path does not exist: {:?} What it means
`FileTree::new` validates its root before building the tree; if the filesystem manager reports the given path does not exist, it returns `io::ErrorKind::NotFound` with the path in the message. The tree cannot be rooted at a non-existent location.
Solutions
- Check that the path exists (fs::metadata or fs_manager.exists) before constructing the tree
- Correct the path/workspace configuration to an existing directory
- Create the missing directory if it is expected to exist
- Surface the error to the user with the path so they can pick a valid root
Example fix
// before
let tree = FileTree::new(cfg_root.clone(), fs.clone()).await?;
// after
if !fs.exists(&cfg_root).await {
eprintln!("root not found: {:?}", cfg_root);
return Ok(None);
}
let tree = FileTree::new(cfg_root.clone(), fs.clone()).await?; Defensive patterns
Strategy: validation
Validate before calling
if !std::path::Path::new(&root_path).is_dir() {
// route to error UI / pick another root
}
Try / catch
match FileTree::new(root_path, fs).await {
Err(e) if e.kind() == io::ErrorKind::NotFound => eprintln!("root missing: {}", root_path.display()),
other => other?,
} Prevention
- Validate workspace roots at startup with a clear user-facing error
- Re-check existence before constructing trees after external changes
- Store absolute canonical paths in config
- Create missing default directories during setup
When it happens
Trigger: Constructing a `FileTree` with a `root_path` that fails `fs_manager.exists()` — deleted/renamed directory, typo in the path, relative path resolved against an unexpected cwd, or a virtual FS without that entry.
Common situations: Opening a project folder that was moved or deleted while the editor ran; passing a user-typed path with a typo; workspace config pointing at a stale directory.
Understand the failure class
Background: "Not Found" / HTTP 404 Errors: What They Mean and How to Fix Them Across Libraries — this error's family across 6 libraries.
Related errors
- Failed to read
- Failed to read plugin
- home directory not found
- Filesystem not available
- Chunk content not found
AI-assisted analysis of sinelaw/fresh@67894ca546 (2026-09-13).
Data as JSON: /api/errors/774814f84a102551.
Report an issue: GitHub.
Appendix: source
Thrown at crates/fresh-editor/src/view/file_tree/tree.rs:39
path_to_node: HashMap<PathBuf, NodeId>,
/// Root node ID
root_id: NodeId,
/// Next node ID to assign
next_id: usize,
/// Filesystem manager for async operations
fs_manager: Arc<FsManager>,
}
impl FileTree {
/// Create a new file tree rooted at the given path
///
/// # Errors
///
/// Returns an error if the root path doesn't exist or isn't a directory.
pub async fn new(root_path: PathBuf, fs_manager: Arc<FsManager>) -> io::Result<Self> {
// Verify root path exists and is a directory
if !fs_manager.exists(&root_path).await {
return Err(io::Error::new(
io::ErrorKind::NotFound,
format!("Path does not exist: {:?}", root_path),
));
}
if !fs_manager.is_dir(&root_path).await? {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!("Path is not a directory: {:?}", root_path),
));
}
// Get root entry
let root_entry = fs_manager.get_entry(&root_path).await?;
// Create root node
let root_id = NodeId(0);
let root_node = TreeNode::new(root_id, root_entry.clone(), None);View on GitHub (pinned to 67894ca546)