xai-org/x-algorithm · error · ValueError
Unknown domain: {domain} for {name!r}
Error message
Unknown domain: {domain} for {name!r} What it means
_convert_domains accepts, per tensor name, a dict (JSON IndexDomain), a ts.DimExpression, or a ts.IndexDomain. Anything else raises this ValueError naming the tensor and the unsupported domain object.
Source
Thrown at phoenix/python/training/xai-checkpointing/xai_checkpointing/load.py:193
cur, cur_bytes = [], 0
cur.append(item)
cur_bytes += nbytes
if cur:
batches.append(cur)
elif plan:
batches.append(plan)
return batches
def _convert_domains(domains: dict[str, Any], host_state: dict[str, jax.Array]) -> dict[str, Any]:
for name, domain in domains.items():
assert host_state.get(name) is not None, f"Cannot restrict domain of skipped tensor {name}"
if isinstance(domain, dict):
domains[name] = ts.IndexDomain(json=domain)
elif isinstance(domain, ts.DimExpression):
domains[name] = ts.IndexDomain(shape=host_state[name].shape)[domain]
elif not isinstance(domain, ts.IndexDomain):
raise ValueError(f"Unknown domain: {domain} for {name!r}")
return domains
def _open_tensor(
checkpoint_name: str,
name: str,
path: pathlib.Path,
use_zarr3: bool,
ts_context: ts.Context,
dest: jax.Array,
has_domain: bool,
tspec_transform: Callable[[dict[str, Any]], dict[str, Any]] | None,
) -> ts.TensorStore:
info = ocp.type_handlers.ParamInfo(
name=checkpoint_name,
path=path / checkpoint_name,
parent_dir=path,
is_ocdbt_checkpoint=True,View on GitHub (pinned to 24c60942c5)
Solutions
- Wrap the restriction in ts.DimExpression (e.g. ts.d[:4]) or pass ts.IndexDomain(shape=...)
- If using a dict, ensure it's valid IndexDomain JSON
- Use 'no_loading' for tensors you want skipped entirely
- Check tensorstore version compatibility if passing its types
Example fix
# before
load_checkpoint(..., domains={"embedding": (slice(0, 1024),)})
# after
import tensorstore as ts
load_checkpoint(..., domains={"embedding": ts.IndexDomain(shape=[V, H])[ts.d[0][:1024]]}) Defensive patterns
Strategy: type-guard
Validate before calling
import tensorstore as ts
def valid_domain(d):
return isinstance(d, (dict, ts.IndexDomain)) or isinstance(d, ts.DimExpression) Type guard
def is_supported_domain(domain) -> bool:
import tensorstore as ts
return isinstance(domain, (dict, ts.DimExpression, ts.IndexDomain)) Prevention
- Construct domains via tensorstore APIs, not raw slices
- Pin the tensorstore version to match xai-checkpointing
When it happens
Trigger: Passing load_checkpoint(..., domains={"params": (slice(0,4),)}) or a list/str/tuple as the domain for a tensor; only the three supported types are recognized.
Common situations: Intuitively passing Python slices/tuples expecting them to work, or passing a TensorStore type from a different tensorstore version with a changed class layout so isinstance checks fail.
Understand the failure class
Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.
Related errors
- unexpected head param layout {sorted(params)} (expected {sor
- type checking expression %s failed: invalid argument type: %
- Non-optional parameter %s must be declared before optional p
- Duplicated argument name %s
- field name %s is not found in struct tuple class %s
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/685c7305d6b32b03.
Report an issue: GitHub.