{"record":{"id":"c6d2f4a4c3febf4d","repo":"astrid-runtime/astrid","slug":"home-must-be-an-absolute-path","errorCode":null,"errorMessage":"HOME must be an absolute path","messagePattern":"HOME must be an absolute path","errorType":"validation","errorClass":"std::io::Error::InvalidInput","httpStatus":null,"severity":"error","filePath":"crates/astrid-core/src/dirs.rs","lineNumber":306,"sourceCode":"            let p = PathBuf::from(&custom);\n            if !p.is_absolute() {\n                return Err(io::Error::new(\n                    io::ErrorKind::InvalidInput,\n                    \"ASTRID_HOME must be an absolute path\",\n                ));\n            }\n            reject_parent_traversal(&p, \"ASTRID_HOME\")?;\n            p\n        } else {\n            let home = home.ok_or_else(|| {\n                io::Error::new(\n                    io::ErrorKind::NotFound,\n                    \"neither ASTRID_HOME nor HOME environment variable is set\",\n                )\n            })?;\n            let home_path = PathBuf::from(&home);\n            if !home_path.is_absolute() {\n                return Err(io::Error::new(\n                    io::ErrorKind::InvalidInput,\n                    \"HOME must be an absolute path\",\n                ));\n            }\n            reject_parent_traversal(&home_path, \"HOME\")?;\n            home_path.join(\".astrid\")\n        };\n\n        Ok(Self { root })\n    }\n\n    /// Create from an explicit path (useful for testing).\n    #[must_use]\n    pub fn from_path(root: impl Into<PathBuf>) -> Self {\n        Self { root: root.into() }\n    }\n\n    /// Validate the durable root without creating a parallel state tree.","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-core/src/dirs.rs#L288-L324","documentation":"Environment validation in AstridDirs::resolve_with_env: ASTRID_HOME is unset and the HOME environment variable is set to a relative path. The home root must be absolute so capsule and state directories land in a stable location regardless of cwd; a relative HOME is rejected with an InvalidInput io error (distinct from the NotFound error raised when HOME is missing entirely).","triggerScenarios":"HOME set to a relative value (e.g. 'home' or '.') when ASTRID_HOME is unset, then invoking the directory resolver.","commonSituations":"Misconfigured container images, wrapper scripts that export HOME incorrectly, or running with env where HOME is a placeholder.","solutions":["Set HOME to an absolute path (e.g. /home/username)","Prefer setting ASTRID_HOME explicitly to a valid absolute path"],"exampleFix":"// before\nexport HOME=home\n// after\nexport HOME=/home/user","handlingStrategy":"validation","validationCode":"if std::env::var(\"ASTRID_HOME\").is_err() {\n    if let Ok(home) = std::env::var(\"HOME\") {\n        assert!(std::path::Path::new(&home).is_absolute(), \"HOME must be absolute\");\n    }\n}","typeGuard":"fn valid_home() -> Option<String> {\n    std::env::var(\"HOME\").ok().filter(|h| std::path::Path::new(h).is_absolute())\n}","tryCatchPattern":"match dirs_result {\n    Err(e) if e.kind() == io::ErrorKind::InvalidInput => {\n        eprintln!(\"Fix HOME: must be an absolute path\");\n    },\n    other => other?,\n}","preventionTips":["Never override HOME with relative values in scripts","Prefer ASTRID_HOME for explicit overrides","Validate environment in entrypoint scripts"],"tags":["env-var","path","config"],"backgroundTag":"invalid-env-var-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}