{"record":{"id":"4f67d8c1efd0fd2c","repo":"abhigyanpatwari/GitNexus","slug":"managed-command-failed-result-state-exit-resu-4f67d8","errorCode":null,"errorMessage":"managed command failed ({result.state}, exit={result.returncode}): {result.detail or result.stderr_tail[-1000:]}","messagePattern":"managed command failed \\((.+?), exit=(.+?)\\): (.+?)","errorType":"exception","errorClass":"ManagedProcessError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":264,"sourceCode":"    *,\n    timeout: int,\n    capture_stdout: bool = False,\n) -> bytes | None:\n    command = [\n        *prefix,\n        SANDBOX_NODE,\n        SANDBOX_GITNEXUS_ENTRYPOINT,\n        *arguments,\n    ]\n    result = run_managed(\n        command,\n        timeout=timeout,\n        env=_graph_environment(),\n        require_pid_namespace=True,\n        capture_stdout_bytes=(2 * 1024 * 1024 if capture_stdout else None),\n    )\n    if not result.ok:\n        raise ManagedProcessError(command, result)\n    if not capture_stdout:\n        return None\n    if result.stdout_capture is None or result.stdout_capture_overflow:\n        raise SandboxError(\"bounded graph-query output was unavailable\")\n    return result.stdout_capture\n\n\ndef _marker_predicate(variable: str) -> str:\n    literals = (\"'\" + marker.replace(\"\\\\\", \"\\\\\\\\\").replace(\"'\", \"\\\\'\") + \"'\" for marker in GRAPH_MARKERS)\n    return \" OR \".join(f\"CAST({variable} AS STRING) CONTAINS {literal}\" for literal in literals)\n\n\ndef _parse_empty_query(raw: bytes, *, label: str) -> None:\n    try:\n        payload = json.loads(raw.decode(\"utf-8\", errors=\"strict\"))\n    except (UnicodeError, json.JSONDecodeError) as exc:\n        raise SandboxError(f\"{label} did not return strict JSON\") from exc\n    if payload == []:","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L246-L282","documentation":"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__.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read exc.result.state, exc.result.returncode, and exc.result.stderr_tail/exc.result.detail to classify crash vs timeout vs sandbox-setup failure.","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.","If state=='killed'/OOM, raise the sandbox memory cap or snapshot a smaller repo.","Reproduce out-of-sandbox with the same node + SANDBOX_GITNEXUS_ENTRYPOINT + args to surface the indexer error directly.","Verify SANDBOX_NODE and SANDBOX_GITNEXUS_ENTRYPOINT exist inside the sandbox and that bwrap/unshare are available."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os, shutil\nfrom workflow_bench.sanitized_graph import SANDBOX_NODE, SANDBOX_GITNEXUS_ENTRYPOINT\n\ndef assert_sandbox_bins_present():\n    for label, path in ((\"node\", SANDBOX_NODE), (\"entrypoint\", SANDBOX_GITNEXUS_ENTRYPOINT)):\n        if not shutil.which(path) and not os.path.exists(path):\n            raise RuntimeError(f\"sandbox binary missing: {label}={path}\")","typeGuard":"from workflow_bench.process_control import ManagedProcessError\n\ndef is_managed_failure(exc: BaseException) -> bool:\n    return isinstance(exc, ManagedProcessError)","tryCatchPattern":"from workflow_bench.process_control import ManagedProcessError\n\ntry:\n    prepare_sanitized_graph(task, repo=repo, resolved_sha=sha, ...)\nexcept ManagedProcessError as exc:\n    r = exc.result\n    log.error(\"graph CLI failed state=%s exit=%s detail=%s\", r.state, r.returncode, r.detail or r.stderr_tail[-500:])\n    if r.state == \"timeout\":\n        ...  # raise the timeout budget and retry once\n    raise","preventionTips":["Pre-flight that SANDBOX_NODE, SANDBOX_GITNEXUS_ENTRYPOINT, bwrap, and unshare exist in the sandbox.","Size GRAPH_BUILD_TIMEOUT_SECONDS to the repo; analyze a smaller snapshot if it is OOM-killed.","Never drop --pdg to work around a failure - error 572 will reject the result."],"tags":["subprocess","sandbox","gitnexus","workflow-bench","timeout"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}