{"record":{"id":"587665e4d87696b6","repo":"xai-org/x-algorithm","slug":"aot-cache-directory-must-be-provided","errorCode":null,"errorMessage":"AOT cache directory must be provided.","messagePattern":"AOT cache directory must be provided\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/utils/aot.py","lineNumber":465,"sourceCode":"            try:\n                os.remove(lock_file)\n            except Exception:\n                pass\n\n\ndef compile_or_load_all_traced(\n    all_traced: Dict[str, TracedWithOptions],\n    aot_cache_dir: str | Path,\n    fdo_profile_dir: Optional[str] = None,\n    run_dir: Optional[str] = None,\n    aot_dump: bool = False,\n    devices: Sequence[xc.Device] | None = None,\n) -> tuple[Dict[str, Compiled], Dict[str, Dict[str, float]]]:\n    if devices is None:\n        devices = []\n\n    if not aot_cache_dir:\n        raise ValueError(\"AOT cache directory must be provided.\")\n\n    aot_cache_dir = Path(aot_cache_dir)\n    rank = jax.process_index()\n    dump_hlo_dir = Path(run_dir) / \"hlos\" if run_dir else Path(f\"/tmp/hlos/{jax.process_index()}\")\n\n    if len(devices) == 0:\n        devices = get_backend().devices()\n    elif isinstance(devices, np.ndarray):\n        devices = devices.flatten()\n    assert isinstance(devices[0], xc.Device), (\n        f\"compile_or_load_all_traced only accepts a list of devices but got: {devices}\"\n    )\n\n    if rank == 0:\n        aot_cache_dir.mkdir(parents=True, exist_ok=True)\n\n    def _compile_or_load(name, traced_with_options, metrics: Dict[str, Dict[str, float]]):\n        profile = read_fdo_profile(name, fdo_profile_dir)","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/utils/aot.py#L447-L483","documentation":"compile_or_load_all_traced requires an AOT cache directory; passing an empty/None aot_cache_dir raises immediately. The cache dir is where compiled executables and metadata are stored for reuse across runs.","triggerScenarios":"Calling compile_or_load / compile_or_load_all_traced without setting aot_cache_dir, or with aot_cache_dir='' after a config default fell through to None.","commonSituations":"Forgetting the cache dir argument when wiring up AOT compilation; configs where the cache dir env var is unset so it resolves to empty.","solutions":["Pass an explicit aot_cache_dir path, e.g. /path/to/aot_cache or run_dir/'aot_cache'","Set the config field / env var that feeds aot_cache_dir","Create the directory beforehand if the caller expects it to exist"],"exampleFix":"# before\ncompiled, meta = compile_or_load_all_traced(traced_fns, aot_cache_dir=None)\n# after\ncompiled, meta = compile_or_load_all_traced(traced_fns, aot_cache_dir=str(run_dir / 'aot_cache'))","handlingStrategy":"validation","validationCode":"assert aot_cache_dir, 'aot_cache_dir required for AOT compilation'\naot_cache_dir = aot_cache_dir or str(Path(run_dir) / 'aot_cache')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default aot_cache_dir from run_dir in config plumbing","Fail fast on empty cache dir at config validation time","Add a required-field check in config dataclass __post_init__"],"tags":["config-validation","aot","cache","missing-argument"],"backgroundTag":"missing-required-config","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}