sigoden/dufs · error · anyhow::Error
Path ` ` doesn't exist
Error message
Path `{}` doesn't exist What it means
sanitize_path in src/args.rs validates user-supplied filesystem arguments (root directory, TLS cert/key paths, etc.). If the given path does not exist on disk it bails with "Path `<path>` doesn't exist"; otherwise it canonicalizes it to an absolute path. This is a fail-fast startup check, not a runtime error.
Solutions
- Check the path exists: ls <path> — fix typos or create the missing file/dir
- Use an absolute path instead of a relative one to be cwd-independent
- Verify Docker/K8s volume mounts actually populate the path
- Run dufs from the intended working directory
Example fix
# before dufs ./asets # after dufs /srv/share # or fix typo: dufs ./assets
Defensive patterns
Strategy: validation
Validate before calling
#!/bin/sh
for p in "$ROOT" "$TLS_CERT" "$TLS_KEY" "$ASSETS"; do
[ -n "$p" ] && [ ! -e "$p" ] && { echo "path does not exist: $p"; exit 1; }
done Prevention
- Use absolute paths in service definitions and containers
- Confirm volume mounts before starting containers
- Test the exact command line from the same cwd systemd/docker uses
- Fix typos by tab-completing paths
When it happens
Trigger: Starting dufs with any CLI path argument (positional root, --tls-cert, --tls-key, --assets) that points to a nonexistent file/directory; typos, wrong working directory when using relative paths, or Docker volumes not mounted.
Common situations: Typo in the serve root path; running the binary from a different cwd than expected so relative paths break; container mounts missing so /data is empty; deleted cert files.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- No tls-key set
- No tls-cert set
- Path ` ` doesn't contains index.html
- Invalid bind address
- Invalid auth, no duplicate anonymous rules
AI-assisted analysis of sigoden/dufs@fe7fd564f8 (2026-09-09).
Data as JSON: /api/errors/f254b2d2215d4112.
Report an issue: GitHub.
Appendix: source
Thrown at src/args.rs:462
(Some(_), Some(_)) => {}
(Some(_), _) => bail!("No tls-key set"),
(_, Some(_)) => bail!("No tls-cert set"),
(None, None) => {}
}
}
#[cfg(not(feature = "tls"))]
{
args.tls_cert = None;
args.tls_key = None;
}
Ok(args)
}
fn sanitize_path<P: AsRef<Path>>(path: P) -> Result<PathBuf> {
let path = path.as_ref();
if !path.exists() {
bail!("Path `{}` doesn't exist", path.display());
}
env::current_dir()
.and_then(|mut p| {
p.push(path); // If path is absolute, it replaces the current path.
std::fs::canonicalize(p)
})
.with_context(|| format!("Failed to access path `{}`", path.display()))
}
fn sanitize_assets_path<P: AsRef<Path>>(path: P) -> Result<PathBuf> {
let path = Self::sanitize_path(path)?;
if !path.join("index.html").exists() {
bail!("Path `{}` doesn't contains index.html", path.display());
}
Ok(path)
}
}View on GitHub (pinned to fe7fd564f8)