abhigyanpatwari/GitNexus · error · ManagedProcessError

managed command failed ({result.state}, exit={result.returnc

Error message

managed command failed ({result.state}, exit={result.returncode}): {result.detail or result.stderr_tail[-1000:]}

What it means

A ManagedProcessError (RuntimeError subclass) raised by _run_graph_cli when run_managed reports the sandboxed 'node <gitnexus entrypoint> ...' command did not exit 0. The message interpolates result.state (exited/killed/timeout), result.returncode, and either result.detail or the last 1000 bytes of stderr. The same message format is shared by every run_managed caller via ManagedProcessError.__init__.

Source

Thrown at eval/workflow_bench/sanitized_graph.py:264

    *,
    timeout: int,
    capture_stdout: bool = False,
) -> bytes | None:
    command = [
        *prefix,
        SANDBOX_NODE,
        SANDBOX_GITNEXUS_ENTRYPOINT,
        *arguments,
    ]
    result = run_managed(
        command,
        timeout=timeout,
        env=_graph_environment(),
        require_pid_namespace=True,
        capture_stdout_bytes=(2 * 1024 * 1024 if capture_stdout else None),
    )
    if not result.ok:
        raise ManagedProcessError(command, result)
    if not capture_stdout:
        return None
    if result.stdout_capture is None or result.stdout_capture_overflow:
        raise SandboxError("bounded graph-query output was unavailable")
    return result.stdout_capture


def _marker_predicate(variable: str) -> str:
    literals = ("'" + marker.replace("\\", "\\\\").replace("'", "\\'") + "'" for marker in GRAPH_MARKERS)
    return " OR ".join(f"CAST({variable} AS STRING) CONTAINS {literal}" for literal in literals)


def _parse_empty_query(raw: bytes, *, label: str) -> None:
    try:
        payload = json.loads(raw.decode("utf-8", errors="strict"))
    except (UnicodeError, json.JSONDecodeError) as exc:
        raise SandboxError(f"{label} did not return strict JSON") from exc
    if payload == []:

View on GitHub (pinned to d540b00184)

Solutions

  1. Read exc.result.state, exc.result.returncode, and exc.result.stderr_tail/exc.result.detail to classify crash vs timeout vs sandbox-setup failure.
  2. If state=='timeout', raise GRAPH_BUILD_TIMEOUT_SECONDS or shrink the snapshot; note error 572 enforces that --pdg produced output, so do not drop --pdg.
  3. If state=='killed'/OOM, raise the sandbox memory cap or snapshot a smaller repo.
  4. Reproduce out-of-sandbox with the same node + SANDBOX_GITNEXUS_ENTRYPOINT + args to surface the indexer error directly.
  5. Verify SANDBOX_NODE and SANDBOX_GITNEXUS_ENTRYPOINT exist inside the sandbox and that bwrap/unshare are available.
Defensive patterns

Strategy: try-catch

Validate before calling

import os, shutil
from workflow_bench.sanitized_graph import SANDBOX_NODE, SANDBOX_GITNEXUS_ENTRYPOINT

def assert_sandbox_bins_present():
    for label, path in (("node", SANDBOX_NODE), ("entrypoint", SANDBOX_GITNEXUS_ENTRYPOINT)):
        if not shutil.which(path) and not os.path.exists(path):
            raise RuntimeError(f"sandbox binary missing: {label}={path}")

Type guard

from workflow_bench.process_control import ManagedProcessError

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

Try / catch

from workflow_bench.process_control import ManagedProcessError

try:
    prepare_sanitized_graph(task, repo=repo, resolved_sha=sha, ...)
except ManagedProcessError as exc:
    r = exc.result
    log.error("graph CLI failed state=%s exit=%s detail=%s", r.state, r.returncode, r.detail or r.stderr_tail[-500:])
    if r.state == "timeout":
        ...  # raise the timeout budget and retry once
    raise

Prevention

When it happens

Trigger: The sandboxed 'gitnexus analyze ... --pdg' (GRAPH_BUILD_TIMEOUT_SECONDS=3600) or the 'gitnexus cypher ...' marker-proof query (GRAPH_QUERY_TIMEOUT_SECONDS=300) exits non-zero, is killed (e.g. OOM), or hits its timeout inside _run_graph_cli.

Common situations: Indexer crash/panic in the sandbox; OOM-kill under --workers 1; bwrap/unshare sandbox setup failure; analyze exceeding 3600s on a large repo; a missing tree-sitter grammar making analyze fail; the cypher proof query failing on an empty/corrupt graph.

Related errors


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