abhigyanpatwari/GitNexus · error · ManagedProcessError

managed command failed ({state}, exit={returncode}): {detail

Error message

managed command failed ({state}, exit={returncode}): {detail}

What it means

Thrown as ManagedProcessError in apply_candidate_overlay (evolution.py:394) when the in-sandbox '/bin/mkdir -p /tmp/wfbench-empty-hooks' command does not finish cleanly. ManagedProcessError (process_control.py) formats state+returncode+detail (or the last 1000 bytes of stderr). result.ok is true only when state=='exited' and returncode==0, so any other terminal state — timeout, forced-kill, spawn-failure, ownership-failure — raises.

Source

Thrown at eval/workflow_bench/evolution.py:394

    overlay = overlay.expanduser().absolute()
    expected_clone = Path(os.path.abspath(worktree.expanduser()))
    sandbox_clone = Path(os.path.abspath(sandbox.clone.expanduser()))
    if sandbox_clone != expected_clone:
        raise ValueError("candidate sandbox does not bind the requested clone")
    digest, payload = candidate_overlay_payload(overlay)
    relative_paths: list[str] = []
    for relative, content in payload:
        _replace_regular_file(worktree, relative, content)
        relative_paths.append(relative.as_posix())

    mkdir_command = ["/bin/mkdir", "-p", f"{SANDBOX_TMP}/wfbench-empty-hooks"]
    mkdir_result = sandbox.run(
        mkdir_command,
        timeout=60,
        env=build_sandbox_environment(),
    )
    if not mkdir_result.ok:
        raise ManagedProcessError(mkdir_command, mkdir_result)

    command, added = _sandbox_overlay_git(sandbox, ["add", "--", *relative_paths])
    if not added.ok:
        raise ManagedProcessError(command, added)
    command, changed = _sandbox_overlay_git(
        sandbox,
        ["diff", "--cached", "--quiet", "--no-ext-diff", "--no-textconv", "--"],
    )
    if changed.returncode == 0:
        raise ValueError("candidate overlay is byte-identical to the incumbent skills")
    if changed.returncode != 1:
        raise ManagedProcessError(command, changed)

    command, committed = _sandbox_overlay_git(
        sandbox,
        [
            "commit",
            "--quiet",

View on GitHub (pinned to d540b00184)

Solutions

  1. Run preflight_bubblewrap() and require_claude_sandbox_helpers() first to surface the exact missing primitive.
  2. Inspect err.result.state and err.result.stderr_tail to identify spawn/ownership/timeout.
  3. Ensure /bin/mkdir and /tmp are available inside the sandbox bind set (check build_sandbox_environment / mount args).
  4. Run on a Linux host with Bubblewrap installed.

Example fix

# before: call apply without preflight -> opaque 'spawn-failure'
apply_candidate_overlay(overlay, worktree, sandbox=sandbox)

# after: preflight and inspect the managed result
from workflow_bench.proposer_sandbox import preflight_bubblewrap, require_claude_sandbox_helpers
from workflow_bench.process_control import ManagedProcessError
preflight_bubblewrap()
require_claude_sandbox_helpers()
try:
    apply_candidate_overlay(overlay, worktree, sandbox=sandbox)
except ManagedProcessError as exc:
    print(exc.result.state, exc.result.returncode, exc.result.stderr_tail[-500:])
    raise
Defensive patterns

Strategy: try-catch

Validate before calling

from workflow_bench.proposer_sandbox import preflight_bubblewrap, require_claude_sandbox_helpers

def sandbox_preflight_ok() -> bool:
    try:
        preflight_bubblewrap()
        require_claude_sandbox_helpers()
        return True
    except Exception:
        return False

Type guard

from workflow_bench.process_control import ManagedProcessError, ManagedProcessResult

def is_managed_failure(exc: BaseException) -> bool:
    return isinstance(exc, ManagedProcessError)

Try / catch

from workflow_bench.process_control import ManagedProcessError

try:
    apply_candidate_overlay(overlay, worktree, sandbox=sandbox)
except ManagedProcessError as exc:
    res = exc.result
    print('mkdir failed:', res.state, res.returncode, res.detail or res.stderr_tail[-500:])
    raise

Prevention

When it happens

Trigger: The sandbox cannot spawn the mkdir: bwrap/PID-namespace ownership absent, the spawn fails, the command times out (60s), or mkdir exits non-zero. The detail field distinguishes which: 'spawn-failure', 'ownership-failure', 'timeout', 'forced-kill', or the captured stderr.

Common situations: bwrap not installed or preflight not run; sandbox helper (socat) missing; sandbox environment misbuilt so /bin or /tmp is not bound; running on a non-Linux host where Bubblewrap cannot establish the PID namespace.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/263f45dbaa99a578. Report an issue: GitHub.