{"record":{"id":"1d1eb09e35f19870","repo":"abhigyanpatwari/GitNexus","slug":"required-executable-is-not-an-executable-regular-f","errorCode":null,"errorMessage":"required executable is not an executable regular file: {path}","messagePattern":"required executable is not an executable regular file: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/proposer_sandbox.py","lineNumber":470,"sourceCode":"    evidence-provenance.mjs's PATH-scan correctly refuses to trust. This\n    wrapper is freshly created by the same host process that owns\n    home/temp/shell-prefix, so it maps to the sandbox's own trusted uid\n    instead, and simply execs the real interpreter through to do the work.\n    \"\"\"\n\n    wrapper = private_root / \"python3\"\n    wrapper.write_text('#!/bin/bash\\nset -eu\\nexec /usr/bin/python3 \"$@\"\\n')\n    wrapper.chmod(0o500)\n    return wrapper\n\n\ndef _resolve_executable(executable: Path | str | None, default: str) -> Path:\n    raw = os.fspath(executable) if executable is not None else shutil.which(default)\n    if not raw:\n        raise SandboxError(f\"required executable is unavailable: {default}\")\n    path = Path(raw).expanduser().resolve()\n    if not path.is_file() or not os.access(path, os.X_OK):\n        raise SandboxError(f\"required executable is not an executable regular file: {path}\")\n    return path\n\n\ndef preflight_bubblewrap(bwrap_bin: Path | str | None = None) -> Path:\n    \"\"\"Prove the required namespaces work; never fall back to host execution.\"\"\"\n\n    if sys.platform != \"linux\":\n        raise SandboxError(f\"Bubblewrap containment is supported only on Linux/WSL2, not {sys.platform}\")\n    bwrap = _resolve_executable(bwrap_bin, \"bwrap\")\n    command = [\n        str(bwrap),\n        \"--unshare-user\",\n        \"--unshare-pid\",\n        \"--unshare-ipc\",\n        \"--unshare-uts\",\n        \"--die-with-parent\",\n        \"--new-session\",\n        *_runtime_mount_args(),","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/proposer_sandbox.py#L452-L488","documentation":"Raised by _resolve_executable after locating the candidate path: Path(raw).resolve() either is not a regular file or os.access(path, X_OK) is false. The sandbox will not exec something that is a directory, a broken symlink, a non-executable file, or a file the current user cannot execute.","triggerScenarios":"An explicit executable argument (or a which() result) points to a directory, a file without the executable bit, a symlink whose target is missing/non-executable, or a path the current user cannot execute.","commonSituations":"Wrapper script created without chmod +x; path points at a directory (e.g. /opt/claude/nodejs instead of the node binary); filesystem mounted noexec; broken symlink returned by a stale which cache; running as a user without execute rights on the binary (permissions 0o644); a pyenv/asdf shim that lost its target after an uninstall.","solutions":["chmod +x the target file if it should be executable.","Point at the real binary, not a directory or shim: pass the absolute path to the executable file.","Reinstall the tool if its binary was removed/corrupted.","Check permissions: ls -l path and ensure an x bit for the current user; fix mount options if noexec."],"exampleFix":"// before\nnode = _resolve_executable('/opt/claude/nodejs', 'node')  # a directory\n// after\nnode = _resolve_executable('/opt/claude/nodejs/bin/node', 'node')\nPath(node).chmod(0o755)","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\ndef is_executable_file(p: Path) -> bool:\n    return p.is_file() and os.access(p, os.X_OK)\n\nexe = Path(shutil.which('node'))\nassert is_executable_file(exe)\n_resolve_executable(str(exe), 'node')","typeGuard":"import os\nfrom pathlib import Path\n\ndef is_executable_regular_file(value: object) -> bool:\n    if not isinstance(value, Path):\n        return False\n    return value.is_file() and os.access(value, os.X_OK)","tryCatchPattern":"try:\n    path = _resolve_executable(candidate, 'node')\nexcept SandboxError as exc:\n    if 'not an executable regular file' in str(exc):\n        path.chmod(0o755)\n        path = _resolve_executable(candidate, 'node')\n    raise","preventionTips":["chmod +x scripts at install time.","Pass absolute paths to real binaries, not directories or shims.","Check is_file()+os.access(X_OK) before calling.","Watch for noexec mounts in CI."],"tags":["executable","filesystem","permissions","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}