usestrix/strix · error · ValueError

Refusing to mount '{resolved}' into the sandbox: it is a sys

Error message

Refusing to mount '{resolved}' into the sandbox: it is a system or home directory, not a codebase. Point the target at the project directory you want tested.

What it means

A safety guard that refuses to mount system or home directories into the Docker sandbox. The resolved path is rejected if it equals a forbidden root ('/', '/var', '/opt', '/home', '/root', '/Users', '/Volumes', plus resolved forms and the user's home), is a filesystem root, or lies within a forbidden tree (/etc, /usr, /bin, /Applications, /System, Windows/Program Files, etc.). Rationale: mounting those exposes the OS and personal files to the scanner container.

Source

Thrown at strix/interface/utils.py:1406

        raise ValueError(f"'{path}' is not an existing directory.")

    # Both the literal and the resolved form: macOS reaches /etc through the
    # /private/etc symlink, and only the resolved path is compared below.
    exact = {str(Path(root)).casefold() for root in _FORBIDDEN_MOUNT_ROOTS}
    exact |= {str(Path(root).resolve()).casefold() for root in _FORBIDDEN_MOUNT_ROOTS}
    exact.add(str(Path.home().resolve()).casefold())
    tree_roots = set(_FORBIDDEN_MOUNT_TREES)
    if os.name == "nt":
        drive = Path(resolved.anchor)
        tree_roots |= {str(drive / name) for name in _FORBIDDEN_WINDOWS_TREE_NAMES}
        exact.add(str(drive / "Users").casefold())
    trees = [Path(root) for root in tree_roots] + [Path(root).resolve() for root in tree_roots]
    if (
        str(resolved).casefold() in exact
        or resolved.parent == resolved
        or any(_is_within(resolved, tree) for tree in trees)
    ):
        raise ValueError(
            f"Refusing to mount '{resolved}' into the sandbox: it is a system "
            "or home directory, not a codebase. Point the target at the "
            "project directory you want tested."
        )

    credential = next(
        (part for part in resolved.parts if part.casefold() in _FORBIDDEN_MOUNT_DIR_NAMES), None
    )
    if credential is not None:
        raise ValueError(
            f"Refusing to mount '{resolved}' into the sandbox: '{credential}' "
            "holds credentials, not code."
        )


def dedupe_local_targets(targets_info: list[dict[str, Any]]) -> list[dict[str, Any]]:
    result: list[dict[str, Any]] = []
    seen_paths: set[str] = set()

View on GitHub (pinned to 8551339130)

Solutions

  1. Target the specific project directory, e.g. ~/projects/app not ~ itself.
  2. If the project lives under a forbidden tree (/opt, /Applications), copy or clone it to a normal location like ~/code and scan that.
  3. Do not use /, /home, /Users, /var, /opt, /root, /Volumes, /etc, /usr (or Windows system dirs) as scan targets.

Example fix

# before
strix -n -t ~                 # home directory refused

# after
strix -n -t ~/projects/my-app  # actual codebase directory
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
import os

FORBIDDEN_ROOTS = {"/", "/private", "/var", "/opt", "/home", "/root", "/srv", "/users", "/volumes"}
FORBIDDEN_TREES = ("/bin", "/sbin", "/usr", "/etc", "/lib", "/lib64", "/nix/store",
                    "/run/current-system/sw", "/applications", "/library", "/system",
                    "/dev", "/boot", "/proc", "/sys")

def is_safe_mount_dir(path: str) -> bool:
    resolved = Path(path).resolve()
    r = str(resolved).casefold()
    if r in FORBIDDEN_ROOTS or r == str(Path.home().resolve()).casefold():
        return False
    if resolved.parent == resolved:
        return False
    return not any(r.startswith(t) for t in FORBIDDEN_TREES)

if not is_safe_mount_dir(target):
    raise SystemExit(f"{target} is a system/home directory; target the project dir instead")

Type guard

def is_specific_project_dir(path: str) -> bool:
    from pathlib import Path
    resolved = Path(path).resolve()
    return resolved.is_dir() and resolved != Path.home().resolve() and len(resolved.parts) > 2 and not str(resolved).startswith(('/usr', '/etc', '/bin', '/Applications', '/System'))

Try / catch

try:
    check_mountable_dir(Path(target))
except ValueError as e:
    if "system or home directory" in str(e):
        raise SystemExit("Strix refuses system/home mounts. Point -t at the project subdirectory.") from e
    raise

Prevention

When it happens

Trigger: Running strix -t / or -t ~/my-project (home dir itself is forbidden); -t /etc, -t /Applications/some.app, -t 'C:\Program Files', -t /opt/tool; any path that resolves under one of the forbidden trees or equals home().

Common situations: Trying to scan 'everything' with -t ~ or -t /; putting a project inside /opt or /Applications and targeting that prefix; running as root with repos under /root; targeting a mounted volume under /Volumes on macOS.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/8491039b1073c36d. Report an issue: GitHub.