{"record":{"id":"ae00b2ae80bff213","repo":"oracle/graal","slug":"environment-variable-graalos-build-is-unset-it","errorCode":null,"errorMessage":"Environment variable 'GRAALOS_BUILD' is unset! It must point to the GraalOS build directory!","messagePattern":"Environment variable 'GRAALOS_BUILD' is unset! It must point to the GraalOS build directory!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdk/mx.sdk/mx_sdk_benchmark.py","lineNumber":2240,"sourceCode":"        super()._prepare_for_running(args, out, err, cwd, nonZeroIsFatal)\n        benchmark: str = bm_exec_context().get(\"benchmark\")\n        if benchmark.startswith(\"interpreter/c-\"):\n            # Disable C-native-extension benchmarks on GraalOS due to os.symlink not being supported (GR-71952)\n            mx.abort(f\"Benchmark '{benchmark}' (and all other C-native-extension benchmarks) is not supported on GraalHost!\")\n\n    def run_stage_image(self):\n        # Start with resolving prerequisite environment variables\n        build_dir = self._resolve_graalos_build_dir()\n        # Stage benchmark\n        super().run_stage_image()\n        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:","sourceCodeStart":2222,"sourceCodeEnd":2258,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/mx.sdk/mx_sdk_benchmark.py#L2222-L2258","documentation":"Raised by GraalHostPolyBenchStagingVm._resolve_graalos_build_dir: the GRAALOS_BUILD environment variable must be set for GraalHost staged benchmarks because the run stage needs the GraalOS build artifacts (graalhost binary, config files). Unset means the environment was not provisioned, and a ValueError is thrown before staging starts.","triggerScenarios":"Running a GraalHost PolyBench benchmark (run_stage_image or run_stage_run) without exporting GRAALOS_BUILD, e.g. 'mx benchmark polybench-graalhost ...' in a shell that never sourced the GraalOS build environment.","commonSituations":"CI jobs or fresh shells that skip the GraalOS setup step; developers running only part of the staged pipeline assuming defaults exist.","solutions":["Export GRAALOS_BUILD to the GraalOS build directory: export GRAALOS_BUILD=/path/to/graalos/build.","Add the export to the CI environment or the suite's env-setup script so all mx benchmark invocations inherit it.","Confirm the directory actually contains graalhost/graalhost to avoid the follow-up executable errors."],"exampleFix":"# before\n$ mx benchmark polybench-graalhost   # ValueError: GRAALOS_BUILD is unset\n\n# after\n$ export GRAALOS_BUILD=$HOME/graalos/build && mx benchmark polybench-graalhost","handlingStrategy":"validation","validationCode":"import os\nassert os.environ.get('GRAALOS_BUILD'), 'export GRAALOS_BUILD=<graalos build dir> before running GraalHost benchmarks'","typeGuard":null,"tryCatchPattern":"try/except ValueError at the benchmark entrypoint; convert to a friendly message telling the user which env var to export.","preventionTips":["Create a single env.sh exporting GRAALOS_BUILD and ROOTFS; source it in every benchmark job.","Add env-var preflight checks to CI scripts before invoking mx."],"tags":["mx","benchmark","graalos","environment","env-var"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}