{"record":{"id":"8a77e56da8f2a03c","repo":"astrid-runtime/astrid","slug":"is-redirected","errorCode":null,"errorMessage":"{} is redirected: {}","messagePattern":"(.+?) is redirected: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-core/src/dirs_run_dir.rs","lineNumber":38,"sourceCode":"        return Ok(None);\n    };\n    let path = PathBuf::from(raw);\n    if path.as_os_str().is_empty() {\n        return Err(invalid(\"must not be empty\"));\n    }\n    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())?;","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-core/src/dirs_run_dir.rs#L20-L56","documentation":"The run-dir resolver validates the configured directory variable's path: after rejecting '.'/'..' components, it uses symlink_metadata and refuses any path that is a symlink with InvalidData, formatting '{VARIABLE} is redirected: <path>'. This enforces that run directories are real directories, never redirects that could move runtime state outside the intended location.","triggerScenarios":"The env variable / config that sets the run dir (e.g. during resolved(), called from configured_path() or validate()) points to a path that is a symlink — including the classic /tmp on macOS or user-home symlink setups.","commonSituations":"User pointed the run-dir env var at /tmp or ~/... which is a symlink on their OS; admins symlinked the run dir to another volume; default locations resolved through /var or /run symlinks.","solutions":["Set the run-dir variable to a path that is (or create) a real directory — mkdir the literal path and keep the data there instead of a link.","If capacity requires another volume, mount that volume at the configured path (mountpoint of a real dir is fine; a symlink is not).","Remove the symlink and relocate content: rm <link> && mv <target> <path>."],"exampleFix":"// before\nexport ASTRID_RUN_DIR=/tmp/astrid   # /tmp -> private/tmp on macOS\n// after\nmkdir -p /var/astrid/run\nexport ASTRID_RUN_DIR=/var/astrid/run","handlingStrategy":"validation","validationCode":"fn validate_run_dir(raw: &str) -> io::Result<()> {\n    let p = PathBuf::from(raw);\n    if p.components().any(|c| matches!(c, Component::CurDir | Component::ParentDir)) {\n        return Err(io::Error::new(io::ErrorKind::InvalidData, \"bad components\"));\n    }\n    if std::fs::symlink_metadata(&p)?.file_type().is_symlink() {\n        return Err(io::Error::new(io::ErrorKind::InvalidData, \"run dir is a symlink\"));\n    }\n    Ok(())\n}","typeGuard":"fn run_dir_is_real(p: &Path) -> bool {\n    std::fs::symlink_metadata(p).map(|m| !m.file_type().is_symlink() && m.is_dir()).unwrap_or(false)\n}","tryCatchPattern":"match RunDir::configured_path() {\n    Err(e) if e.to_string().contains(\"is redirected\") => eprintln!(\"use a real directory, not a symlink: {e}\"),\n    other => other?,\n}","preventionTips":["Resolve symlinks yourself (canonicalize, then configure the canonical path is NOT enough — pick a non-link location)","Create run dirs with mkdir -p at real paths","Remember macOS /tmp and some home dirs are symlinks; avoid pointing run-dir vars at them","Test the configured path at startup with a symlink check"],"tags":["rust","symlink","configuration"],"backgroundTag":"symlink-detected-in-path","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}