{"record":{"id":"e8a8eef6d45273a5","repo":"astrid-runtime/astrid","slug":"is-not-a-real-directory","errorCode":null,"errorMessage":"{} is not a real directory: {}","messagePattern":"(.+?) is not a real directory: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-core/src/dirs_run_dir.rs","lineNumber":44,"sourceCode":"    if !path.is_absolute() {\n        return Err(invalid(\"must be an absolute path\"));\n    }\n    if path\n        .components()\n        .any(|component| matches!(component, Component::ParentDir | Component::CurDir))\n    {\n        return Err(invalid(\"must not contain '.' or '..' path components\"));\n    }\n\n    match std::fs::symlink_metadata(&path) {\n        Ok(metadata) if metadata.file_type().is_symlink() => {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"{VARIABLE} is redirected: {}\", path.display()),\n            ));\n        },\n        Ok(metadata) if !metadata.is_dir() => {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"{VARIABLE} is not a real directory: {}\", path.display()),\n            ));\n        },\n        Ok(_) => {},\n        Err(error) if error.kind() == io::ErrorKind::NotFound => {},\n        Err(error) => return Err(error),\n    }\n    crate::platform_fs::verify_no_redirects(&path)?;\n\n    let physical_run = physical_path(&path)?;\n    let physical_root = physical_path(home.root())?;\n    if paths_are_related(&physical_run, &physical_root)\n        || directories_are_aliases(&physical_run, &physical_root)\n    {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-core/src/dirs_run_dir.rs#L26-L62","documentation":"This error is thrown while validating the ASTRID_RUN_DIR environment variable: the configured path exists (symlink_metadata succeeded) but its metadata says it is not a directory (e.g. it is a regular file, socket, or fifo). Astrid requires the run dir to be either nonexistent (it will be created) or a real, non-symlinked directory, so any other file type is rejected with io::ErrorKind::InvalidData before the daemon starts writing runtime state there.","triggerScenarios":"Setting ASTRID_RUN_DIR to a path that already exists as a regular file, socket, fifo, or device node; calling AstridHome validation (configured_path/validate) while a stale file occupies the intended run-dir path.","commonSituations":"A leftover lockfile or pidfile was left at the run-dir path by a previous crashed run; an operator set ASTRID_RUN_DIR=/var/run/astrid.pid by mistake; a container volume mounted a file where a directory was expected.","solutions":["Check the path with `ls -ld \"$ASTRID_RUN_DIR\"`; if it is a file, remove or rename it (`mv \"$ASTRID_RUN_DIR\" \"$ASTRID_RUN_DIR.bak\"`) so Astrid can create a directory there","Point ASTRID_RUN_DIR at a path that is a real directory (e.g. /run/astrid or a tmpfs mount) instead of a file","If the entry is a symlink, point ASTRID_RUN_DIR at the real target directory directly (symlinks are rejected separately)"],"exampleFix":"// before\nexport ASTRID_RUN_DIR=/var/run/astrid.pid   # a file\n// after\nrm /var/run/astrid.pid\nexport ASTRID_RUN_DIR=/var/run/astrid       # real directory","handlingStrategy":"validation","validationCode":"fn run_dir_ok(p: &std::path::Path) -> bool {\n    match std::fs::symlink_metadata(p) {\n        Ok(m) => m.is_dir() && !m.file_type().is_symlink(),\n        Err(e) => e.kind() == std::io::ErrorKind::NotFound, // created later\n    }\n}","typeGuard":null,"tryCatchPattern":"match astrid_home.validate() {\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidData && e.to_string().contains(\"not a real directory\") => {\n        // fix or clear ASTRID_RUN_DIR, then retry\n    },\n    other => other?,\n}","preventionTips":["Before launch, check the ASTRID_RUN_DIR target: it must be absent or a real (non-symlink) directory","Clean stale pidfiles/lockfiles from the run-dir path after crashes","Never mount a file where the run dir is expected (verify container volumes)"],"tags":["io","filesystem","configuration","env-var"],"backgroundTag":"invalid-config-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}