tinyhumansai/openhuman · error · io::Error

refusing to delete jail outside registry base: {}

Error message

refusing to delete jail outside registry base: {}

What it means

The registry refused to delete a jail whose on-disk directory (after canonicalization) does not lie under the registry base directory. This is a safety guard against a suspicious/corrupted index entry: delete would remove an arbitrary directory outside the managed base, so nothing on disk is touched and the in-memory record is left intact for the caller to diagnose. The record's stored dir and the registry base are the inputs at fault.

Source

Thrown at src/openhuman/sandbox/cwd_jail/registry.rs:279

        let resolved = record
            .dir
            .canonicalize()
            .unwrap_or_else(|_| record.dir.clone());
        let resolved_base = self
            .base
            .canonicalize()
            .unwrap_or_else(|_| self.base.clone());
        if !resolved.starts_with(&resolved_base) {
            // Index is suspicious — don't touch anything on disk and
            // leave the in-memory record alone too. The caller can
            // diagnose and fix.
            log::warn!(
                "[cwd_jail] refusing delete: dir {} not under base {}",
                resolved.display(),
                resolved_base.display()
            );
            return Err(io::Error::new(
                io::ErrorKind::PermissionDenied,
                format!(
                    "refusing to delete jail outside registry base: {}",
                    resolved.display()
                ),
            ));
        }

        if record.dir.exists() {
            fs::remove_dir_all(&record.dir)?;
        }
        // Disk side succeeded — now remove from the index and persist.
        // If persist fails here the directory is already gone, so we
        // can't fully roll back; we keep the in-memory removal aligned
        // with disk reality and surface the error.
        idx.records.remove(id);
        if let Err(e) = self.persist(&idx) {
            log::warn!(

View on GitHub (pinned to 7491200858)

Solutions

  1. Inspect the jail record's dir field and the registry base to see how the entry diverged (manually edited index, moved base, symlinked dir)
  2. Fix or remove the bad entry in the registry index manually rather than via delete
  3. If the base was relocated intentionally, migrate the registry index to the new base
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/sandbox/cwd_jail/registry.rs:279 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/4f0090666eae88fb. Report an issue: GitHub.