{"record":{"id":"0bb134e196ab582a","repo":"oracle/graal","slug":"environment-variable-graalos-build-points-to-b","errorCode":null,"errorMessage":"Environment variable 'GRAALOS_BUILD' points to '{build_dir}' which is not a directory!","messagePattern":"Environment variable 'GRAALOS_BUILD' points to '(.+?)' which is not a directory!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdk/mx.sdk/mx_sdk_benchmark.py","lineNumber":2243,"sourceCode":"            # 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:\n        if not path.is_file():\n            raise ValueError(f\"{description} '{path}' does not exist!\")\n        if not os.access(path, os.X_OK):","sourceCodeStart":2225,"sourceCodeEnd":2261,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/mx.sdk/mx_sdk_benchmark.py#L2225-L2261","documentation":"Same resolver as the unset case, but here GRAALOS_BUILD is set and resolves (via Path.resolve) to a path that is not a directory — e.g. it points at a file, a broken symlink target, or a nonexistent path after resolve(). The harness needs a real build directory, so it raises ValueError naming the offending path.","triggerScenarios":"GRAALOS_BUILD=/some/file.txt, a symlink to a removed build dir, or a typo'd path (resolve() of a nonexistent path yields an absolute nonexistent path, which is_dir() rejects).","commonSituations":"Stale export pointing to a deleted build tree after a clean; path typos; relative exports evaluated from a different cwd so resolve() lands elsewhere.","solutions":["Point GRAALOS_BUILD at the actual GraalOS build directory (verify with 'ls \"$GRAALOS_BUILD/graalhost\").","Rebuild GraalOS if the build tree was removed, then re-export.","Use an absolute path to avoid cwd-dependent resolution."],"exampleFix":"# before\nexport GRAALOS_BUILD=~/graalos/build/graalhost   # a subdirectory/file, not the build root\n\n# after\nexport GRAALOS_BUILD=$HOME/graalos/build","handlingStrategy":"validation","validationCode":"from pathlib import Path\nb = Path(os.environ['GRAALOS_BUILD']).resolve()\nassert b.is_dir(), f'GRAALOS_BUILD={b} is not a directory; rebuild GraalOS or fix the export'","typeGuard":null,"tryCatchPattern":"try/except ValueError; on failure print the resolved path and directory listing of its parent to spot typos.","preventionTips":["Use absolute exports; avoid relative paths that break under a different cwd.","Verify \"$GRAALOS_BUILD/graalhost\" exists before submitting long benchmark jobs."],"tags":["mx","benchmark","graalos","environment","path-validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}