affaan-m/ECC · error · ValueError

Path '{path}' targets a system directory

Error message

Path '{path}' targets a system directory

What it means

Error "Path '{path}' targets a system directory" thrown in affaan-m/ECC.

Source

Thrown at skills/continuous-learning-v2/scripts/instinct-cli.py:168

    """Validate and resolve a file path, guarding against path traversal.

    Raises ValueError if the path is invalid or suspicious.
    """
    path = Path(path_str).expanduser().resolve()

    # Block paths that escape into system directories
    # We block specific system paths but allow temp dirs (/var/folders on macOS)
    blocked_prefixes = [
        "/etc", "/usr", "/bin", "/sbin", "/proc", "/sys",
        "/var/log", "/var/run", "/var/lib", "/var/spool",
        # macOS resolves /etc → /private/etc
        "/private/etc",
        "/private/var/log", "/private/var/run", "/private/var/db",
    ]
    path_s = str(path)
    for prefix in blocked_prefixes:
        if path_s.startswith(prefix + "/") or path_s == prefix:
            raise ValueError(f"Path '{path}' targets a system directory")

    if must_exist and not path.exists():
        raise ValueError(f"Path does not exist: {path}")

    return path


def _validate_instinct_id(instinct_id: str) -> bool:
    """Validate instinct IDs before using them in filenames."""
    if not instinct_id or len(instinct_id) > 128:
        return False
    if "/" in instinct_id or "\\" in instinct_id:
        return False
    if ".." in instinct_id:
        return False
    if instinct_id.startswith("."):
        return False
    return bool(re.match(r"^[A-Za-z0-9][A-Za-z0-9._-]*$", instinct_id))

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Choose a path outside blocked system directories (/etc, /var/log, /private/etc, etc.); instinct storage must live under a user-writable project or home location.
  2. Point the tool at your project directory instead of a system path.

Example fix

instinct-cli --path "$HOME/.ecc/instincts/my-project"  # not /etc or /var/log

When it happens

Trigger: Thrown at skills/continuous-learning-v2/scripts/instinct-cli.py:168 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/be9cb652d0896c1a. Report an issue: GitHub.