{"record":{"id":"b6c87c2810444af5","repo":"oracle/graal","slug":"environment-variable-rootfs-is-unset-it-must-po","errorCode":null,"errorMessage":"Environment variable 'ROOTFS' is unset! It must point to the CPython file-system root!","messagePattern":"Environment variable 'ROOTFS' is unset! It must point to the CPython file-system root!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdk/mx.sdk/mx_sdk_benchmark.py","lineNumber":2251,"sourceCode":"        self._create_staged_benchmark_run_config_file(build_dir)\n\n    @staticmethod\n    def _resolve_graalos_build_dir() -> Path:\n        \"\"\"Verifies that the GRAALOS_BUILD env var is set and points to a directory. Returns the directory path.\"\"\"\n        graalos_build_env_var = os.getenv(\"GRAALOS_BUILD\")\n        if graalos_build_env_var is None:\n            raise ValueError(\"Environment variable 'GRAALOS_BUILD' is unset! It must point to the GraalOS build directory!\")\n        build_dir = Path(graalos_build_env_var).resolve()\n        if not build_dir.is_dir():\n            raise ValueError(f\"Environment variable 'GRAALOS_BUILD' points to '{build_dir}' which is not a directory!\")\n        return build_dir\n\n    @staticmethod\n    def _resolve_rootfs() -> Path:\n        \"\"\"Verifies that the ROOTFS env var is set and points to a directory. Returns the directory path.\"\"\"\n        rootfs_env_var = os.getenv(\"ROOTFS\")\n        if rootfs_env_var is None:\n            raise ValueError(\"Environment variable 'ROOTFS' is unset! It must point to the CPython file-system root!\")\n        rootfs = Path(rootfs_env_var).resolve()\n        if not rootfs.is_dir():\n            raise ValueError(f\"Environment variable 'ROOTFS' points to '{rootfs}' which is not a directory!\")\n        return rootfs\n\n    @staticmethod\n    def _require_executable(path: Path, description: str) -> Path:\n        if not path.is_file():\n            raise ValueError(f\"{description} '{path}' does not exist!\")\n        if not os.access(path, os.X_OK):\n            raise ValueError(f\"{description} '{path}' is not executable!\")\n        return path\n\n    @staticmethod\n    def _resolve_graalhost_binary(build_dir: Path) -> Path:\n        \"\"\"Resolve the GraalHost binary from the GraalOS build directory.\"\"\"\n        return GraalHostPolyBenchStagingVm._require_executable(build_dir / \"graalhost\" / \"graalhost\", \"GraalHost binary\")\n","sourceCodeStart":2233,"sourceCodeEnd":2269,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/mx.sdk/mx_sdk_benchmark.py#L2233-L2269","documentation":"Raised by _resolve_rootfs: GraalHost staged benchmarks need a CPython file-system root (ROOTFS env var) into which the staged benchmark tree and temp dirs are placed (run_stage_run creates a tempdir under rootfs/tmp). If ROOTFS is unset, staging cannot proceed and ValueError is raised.","triggerScenarios":"Invoking the image or run stage of a GraalHost PolyBench benchmark without exporting ROOTFS; commonly the second of the two required env vars (with GRAALOS_BUILD) that gets forgotten.","commonSituations":"Partial environment setup in CI; docs that only mention GRAALOS_BUILD; running on a machine where the CPython rootfs was prepared once but never exported in the current shell.","solutions":["Export ROOTFS to the prepared CPython root: export ROOTFS=/path/to/cpython-rootfs.","Ensure rootfs/tmp exists and is writable (run_stage_run mkdtemps under it).","Automate both GRAALOS_BUILD and ROOTFS exports in one env script for mx benchmark runs."],"exampleFix":"# before\n$ mx benchmark polybench-graalhost   # ValueError: ROOTFS is unset\n\n# after\n$ export ROOTFS=$HOME/graalos/cpython-rootfs && mx benchmark polybench-graalhost","handlingStrategy":"validation","validationCode":"assert os.environ.get('ROOTFS'), 'export ROOTFS=<cpython rootfs> before running GraalHost benchmarks'","typeGuard":null,"tryCatchPattern":"try/except ValueError at entrypoint; report both required vars (GRAALOS_BUILD, ROOTFS) when either is missing.","preventionTips":["Keep GRAALOS_BUILD and ROOTFS exports together in one setup script.","Ensure rootfs/tmp exists and is writable for the staged tempdir."],"tags":["mx","benchmark","graalos","environment","env-var","cpython"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}