astrid-runtime/astrid · error
sandbox must be an absolute path, got
Error message
sandbox {label} must be an absolute path, got: {} What it means
validate_sandbox_str checks paths interpolated into sandbox profiles (SBPL/bwrap). A relative path cannot be safely or meaningfully expressed in the profile, so the function rejects it with InvalidInput naming the label (e.g. 'process read path') and the offending path.
Solutions
- Convert the path to absolute with std::fs::canonicalize (or path.absolutize) before calling the sandbox API
- Use fs::canonicalize to also resolve symlinks, then pass the canonical path
- If the path may not exist yet, anchor it explicitly: PathBuf::from("/").join(relative) or join against a known root
- Fix configuration files or env vars to store absolute paths
Example fix
// before
wrap_with_process_paths(&ws, &[PathBuf::from("./logs")], &[])?;
// after
let abs = std::fs::canonicalize("./logs")?;
wrap_with_process_paths(&ws, &[abs], &[])?; Defensive patterns
Strategy: validation
Validate before calling
fn ensure_absolute(p: &Path) -> io::Result<()> { if !p.is_absolute() { Err(io::Error::new(io::ErrorKind::InvalidInput, format!("path must be absolute: {}", p.display()))) } else { Ok(()) } } Type guard
fn is_abs(p: &Path) -> bool { p.is_absolute() } Try / catch
match wrap_with_process_paths(&ws, &paths, &[]) { Err(e) if e.kind() == io::ErrorKind::InvalidInput && e.to_string().contains("must be an absolute path") => { /* canonicalize and retry or report to user */ }, other => other, } Prevention
- Always fs::canonicalize user/config-supplied paths before passing them
- Store absolute paths in configuration files
- Anchor relative paths against an explicit known root, never the CWD
When it happens
Trigger: Calling wrap_with_process_paths with relative extra_read_paths/extra_write_paths/injection paths, validate_all_paths with relative workspace paths, or build_seatbelt_prefix with a relative path.
Common situations: Users passing CLI-relative paths like './data' or bare 'data' instead of absolute ones; config files with relative paths resolved against the wrong CWD; env vars holding relative paths.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- process read path does not exist
- process write path does not exist
- sandbox contains forbidden characters (double-quote…
- sandbox is not valid UTF-8
- Astrid volume is not a regular file
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/80784c65950318e5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-workspace/src/sandbox/mod.rs:17
use std::ffi::OsString;
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;
#[cfg(target_os = "linux")]
mod bwrap;
#[cfg(target_os = "macos")]
mod seatbelt;
/// Validate a path for safe interpolation into sandbox profiles (SBPL/bwrap).
///
/// Rejects relative paths, non-UTF-8, double-quote, backslash, and null byte -
/// all of which can break or bypass sandbox profile syntax.
fn validate_sandbox_str<'a>(path: &'a Path, label: &str) -> io::Result<&'a str> {
if !path.is_absolute() {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!(
"sandbox {label} must be an absolute path, got: {}",
path.display()
),
));
}
let s = path.to_str().ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidInput,
format!("sandbox {label} is not valid UTF-8: {}", path.display()),
)
})?;
if s.contains(['"', '\\', '\0']) {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
format!(
"sandbox {label} contains forbidden characters (double-quote, backslash, or null): {}",View on GitHub (pinned to affd8760f4)