{"record":{"id":"f254b2d2215d4112","repo":"sigoden/dufs","slug":"path-doesn-t-exist","errorCode":null,"errorMessage":"Path `{}` doesn't exist","messagePattern":"Path `(.+?)` doesn't exist","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/args.rs","lineNumber":462,"sourceCode":"                (Some(_), Some(_)) => {}\n                (Some(_), _) => bail!(\"No tls-key set\"),\n                (_, Some(_)) => bail!(\"No tls-cert set\"),\n                (None, None) => {}\n            }\n        }\n        #[cfg(not(feature = \"tls\"))]\n        {\n            args.tls_cert = None;\n            args.tls_key = None;\n        }\n\n        Ok(args)\n    }\n\n    fn sanitize_path<P: AsRef<Path>>(path: P) -> Result<PathBuf> {\n        let path = path.as_ref();\n        if !path.exists() {\n            bail!(\"Path `{}` doesn't exist\", path.display());\n        }\n\n        env::current_dir()\n            .and_then(|mut p| {\n                p.push(path); // If path is absolute, it replaces the current path.\n                std::fs::canonicalize(p)\n            })\n            .with_context(|| format!(\"Failed to access path `{}`\", path.display()))\n    }\n\n    fn sanitize_assets_path<P: AsRef<Path>>(path: P) -> Result<PathBuf> {\n        let path = Self::sanitize_path(path)?;\n        if !path.join(\"index.html\").exists() {\n            bail!(\"Path `{}` doesn't contains index.html\", path.display());\n        }\n        Ok(path)\n    }\n}","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/sigoden/dufs/blob/fe7fd564f80dfbac361c8e0589c3845638149d38/src/args.rs#L444-L480","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\ndufs ./asets\n# after\ndufs /srv/share  # or fix typo: dufs ./assets","handlingStrategy":"validation","validationCode":"#!/bin/sh\nfor p in \"$ROOT\" \"$TLS_CERT\" \"$TLS_KEY\" \"$ASSETS\"; do\n  [ -n \"$p\" ] && [ ! -e \"$p\" ] && { echo \"path does not exist: $p\"; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","filesystem","path","rust","startup"],"backgroundTag":"file-not-found","analyzedSha":"fe7fd564f80dfbac361c8e0589c3845638149d38","analyzedAt":"2026-09-09T13:01:22.843Z","contentChangedAt":"2026-09-09T13:01:22.843Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}