astrid-runtime/astrid · error
is redirected
Error message
{} is redirected: {} What it means
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.
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>.
Example fix
// before export ASTRID_RUN_DIR=/tmp/astrid # /tmp -> private/tmp on macOS // after mkdir -p /var/astrid/run export ASTRID_RUN_DIR=/var/astrid/run
Defensive patterns
Strategy: validation
Validate before calling
fn validate_run_dir(raw: &str) -> io::Result<()> {
let p = PathBuf::from(raw);
if p.components().any(|c| matches!(c, Component::CurDir | Component::ParentDir)) {
return Err(io::Error::new(io::ErrorKind::InvalidData, "bad components"));
}
if std::fs::symlink_metadata(&p)?.file_type().is_symlink() {
return Err(io::Error::new(io::ErrorKind::InvalidData, "run dir is a symlink"));
}
Ok(())
} Type guard
fn run_dir_is_real(p: &Path) -> bool {
std::fs::symlink_metadata(p).map(|m| !m.file_type().is_symlink() && m.is_dir()).unwrap_or(false)
} Try / catch
match RunDir::configured_path() {
Err(e) if e.to_string().contains("is redirected") => eprintln!("use a real directory, not a symlink: {e}"),
other => other?,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- canonical Astrid workspace requires the kernel workspace…
- capsule path escaped source root
- directory symlink not allowed in capsule source tree…
- duplicate corpus label
- Failed to resolve ASTRID_HOME for handshake
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/8a77e56da8f2a03c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-core/src/dirs_run_dir.rs:38
return Ok(None);
};
let path = PathBuf::from(raw);
if path.as_os_str().is_empty() {
return Err(invalid("must not be empty"));
}
if !path.is_absolute() {
return Err(invalid("must be an absolute path"));
}
if path
.components()
.any(|component| matches!(component, Component::ParentDir | Component::CurDir))
{
return Err(invalid("must not contain '.' or '..' path components"));
}
match std::fs::symlink_metadata(&path) {
Ok(metadata) if metadata.file_type().is_symlink() => {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("{VARIABLE} is redirected: {}", path.display()),
));
},
Ok(metadata) if !metadata.is_dir() => {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("{VARIABLE} is not a real directory: {}", path.display()),
));
},
Ok(_) => {},
Err(error) if error.kind() == io::ErrorKind::NotFound => {},
Err(error) => return Err(error),
}
crate::platform_fs::verify_no_redirects(&path)?;
let physical_run = physical_path(&path)?;
let physical_root = physical_path(home.root())?;View on GitHub (pinned to affd8760f4)