xai-org/x-algorithm · error · FileNotFoundError

Compiler annotation file {file_path} not found.

Error message

Compiler annotation file {file_path} not found.

What it means

read_annotation_file wraps Path.open to give a clear error when a requested XLA/compiler annotation file (e.g. HLO dump for tuning) does not exist on disk. It is a friendly re-raise of a missing-file condition before reading.

Source

Thrown at phoenix/xrex/utils/aot.py:312


def _lowered_name(lowered: Lowered):
    sym_name = lowered.compiler_ir(dialect="stablehlo").operation.attributes["sym_name"]
    return ir.StringAttr(sym_name).value


@dataclass(frozen=True)
class HashContext:
    hlo: str
    args_info: str
    environment: str
    additional_content: str = None


def read_annotation_file(file_path: str) -> str:
    p = Path(file_path)
    if not p.exists():
        raise FileNotFoundError(f"Compiler annotation file {file_path} not found.")
    with p.open("r") as f:
        return f.read()


def get_sanitized_ir_text(lowered: Lowered, add_loc: bool) -> str:
    module = lowered.compiler_ir(dialect="stablehlo")
    with module.context:
        sanitized = _remove_callbacks(module.operation.clone(), IgnoreCallbacks.ALL)
        return sanitized.operation.get_asm(enable_debug_info=add_loc)


def get_environment_info() -> str:
    backend = get_backend()
    device_kinds = ",".join(sorted({d.device_kind for d in backend.devices()}))
    return "\n".join(
        [
            f"jax={jax.version.__version__}",
            f"jaxlib={jaxlib_version_str}",

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Verify the path exists and is readable before calling (Path(p).exists())
  2. Use paths on a shared filesystem consistent across nodes
  3. Regenerate the annotation/dump if it was cleaned up

Example fix

# before
content = read_annotation_file("/tmp/hlos/0/module_0000.txt")
# after
from pathlib import Path
p = "tmp/hlos/0/module_0000.txt"
content = read_annotation_file(p) if Path(p).exists() else ""
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
if not Path(annotation_path).exists():
    content = ''  # or regenerate
else:
    content = read_annotation_file(annotation_path)

Try / catch

try:
    content = read_annotation_file(p)
except FileNotFoundError:
    logger.warning('annotation missing: %s', p)
    content = ''

Prevention

When it happens

Trigger: Passing a compiler annotation path (from config or _compile_or_load) that doesn't exist: wrong path, file deleted after compile, or path on a node without the shared filesystem mount.

Common situations: HLO dumps referenced by absolute paths not present on other machines; job restarted after /tmp cleanup; typo in the annotation path config.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/89ad9db38e0f8925. Report an issue: GitHub.