{"record":{"id":"2a8bfabd48989574","repo":"astrid-runtime/astrid","slug":"overlaps-the-astrid-durable-root-overlaps","errorCode":null,"errorMessage":"{} overlaps the Astrid durable root: {} overlaps {}","messagePattern":"(.+?) overlaps the Astrid durable root: (.+?) overlaps (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-core/src/dirs_run_dir.rs","lineNumber":60,"sourceCode":"        },\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!(\n                \"{VARIABLE} overlaps the Astrid durable root: {} overlaps {}\",\n                path.display(),\n                home.root().display()\n            ),\n        ));\n    }\n    Ok(Some(physical_run))\n}\n\nfn invalid(detail: &str) -> io::Error {\n    io::Error::new(io::ErrorKind::InvalidInput, format!(\"{VARIABLE} {detail}\"))\n}\n\nfn physical_path(path: &Path) -> io::Result<PathBuf> {\n    if let Ok(physical) = std::fs::canonicalize(path) {\n        return Ok(physical);","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-core/src/dirs_run_dir.rs#L42-L78","documentation":"During ASTRID_RUN_DIR validation Astrid canonicalizes both the configured run dir and the durable root (AstridHome root) and rejects the configuration if they are related (one contains the other) or are aliases of each other (e.g. via hardlinks/bind mounts resolving to the same physical path). Run state is disposable while the durable root is not, so colocating them would let runtime cleanup or writes endanger durable data; the error is io::ErrorKind::InvalidData.","triggerScenarios":"Setting ASTRID_RUN_DIR to the Astrid home root itself, to a subdirectory or parent of it, or to a different path that canonicalizes/aliases to the same physical directory; triggered via configured_path or validate at startup.","commonSituations":"Operator sets ASTRID_RUN_DIR=~/.astrid or ~/.astrid/run thinking it is separate; a bind mount or symlink farm makes two apparently different paths resolve to the same physical directory; defaulting ASTRID_RUN_DIR to the home root in scripts.","solutions":["Choose a run dir outside the Astrid home root, e.g. export ASTRID_RUN_DIR=/run/astrid (a tmpfs path is ideal for disposable state)","Check where the durable root lives (home.root(), typically ~/.astrid) and make sure the run dir is neither inside it nor an ancestor of it","If mount aliases are involved, verify with `realpath` / `findmnt` that the two paths resolve to different physical directories"],"exampleFix":"// before\nexport ASTRID_RUN_DIR=$HOME/.astrid/run        # inside durable root\n// after\nexport ASTRID_RUN_DIR=/run/astrid              # outside durable root","handlingStrategy":"validation","validationCode":"fn overlaps(a: &std::path::Path, b: &std::path::Path) -> bool {\n    let (a, b) = (std::fs::canonicalize(a).unwrap_or(a.into()), std::fs::canonicalize(b).unwrap_or(b.into()));\n    a.starts_with(&b) || b.starts_with(&a)\n}\n// assert !overlaps(run_dir, home_root)","typeGuard":null,"tryCatchPattern":"if let Err(e) = astrid_home.validate() {\n    if e.kind() == std::io::ErrorKind::InvalidData && e.to_string().contains(\"overlaps the Astrid durable root\") {\n        // choose a run dir outside the durable root and retry\n    } else { return Err(e); }\n}","preventionTips":["Always pick a run dir outside the Astrid home root (prefer tmpfs like /run/astrid)","Verify with `realpath` that run dir and durable root are physically distinct (watch for bind mounts/symlink aliases)","Never default ASTRID_RUN_DIR to a subpath or parent of the Astrid home in deployment scripts"],"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"}