xai-org/x-algorithm · error · ValueError

Uknown {dataset_type=}, must be one of {DATASET_TYPES}

Error message

Uknown {dataset_type=}, must be one of {DATASET_TYPES}

What it means

_make_dataset dispatches on dataset_type via a match statement (plus a RANKING_DATASET_FACTORIES registry lookup first). If dataset_type matches no case and no registered factory, it raises with the list of valid DATASET_TYPES. (Message contains the typo 'Uknown'.)

Source

Thrown at phoenix/xrex/configs/xrecsys.py:232

                sid_num_levels=_sid_num_levels,
                enable_stale_post=_enable_stale_post,
            )
        case "toy_dataset":
            return PhoenixToyDataset(
                hash_table=hash_table,
                path=None,
                history_seq_len=mparams["history_seq_len"],
                candidate_seq_len=mparams["candidate_seq_len"],
                input_vocab_size=mparams["input_vocab_size"],
                num_continuous_actions=mparams["num_continuous_actions"],
                num_negatives_per_example=mparams.get("num_negatives_per_example", 1),
                multimodal_embedding_type=mparams.get("multimodal_embedding_type"),
                use_post_sid=_use_post_sid,
                sid_num_levels=_sid_num_levels,
                enable_stale_post=_enable_stale_post,
            )
        case _:
            raise ValueError(f"Uknown {dataset_type=}, must be one of {DATASET_TYPES}")


def _sequence_len(mparams, dataset, num_user_prefix_tokens: int) -> int:
    return (
        num_user_prefix_tokens
        + mparams["history_seq_len"]
        + dataset.candidate_seq_len * (1 + getattr(dataset, "num_negatives_per_example", 0))
        + getattr(dataset, "num_global_negatives_per_example", 0)
    )


def _home_direct_packed_base() -> dict:
    return {
        "history_seq_len": 1022,
        "candidate_seq_len": 64,
        "num_layers": 8,
        "emb_size": 2560,
        "emb_table_width": 1024,

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Set dataset_type to an exact member of DATASET_TYPES (case-sensitive), e.g. 'aggregated_kafka' or 'toy_dataset'
  2. If you need a custom type, register it via config_registry.RANKING_DATASET_FACTORIES before building
  3. Upgrade the package if the type exists in a newer release
  4. Print DATASET_TYPES / RANKING_DATASET_FACTORIES keys to see what is actually available

Example fix

# before
cfg = {..., "dataset_type": "Aggregated_Kafka"}

# after
from phoenix.xrex.configs.xrecsys import DATASET_TYPES
cfg = {..., "dataset_type": "aggregated_kafka"}  # exact member
Defensive patterns

Strategy: validation

Validate before calling

from phoenix.xrex.configs import xrecsys
from phoenix.xrex.configs import config_registry

def validate_dataset_type(dataset_type: str) -> None:
    if dataset_type not in xrecsys.DATASET_TYPES and dataset_type not in config_registry.RANKING_DATASET_FACTORIES:
        raise SystemExit(
            f"Invalid dataset_type {dataset_type!r}; valid: {xrecsys.DATASET_TYPES}"
        )

Type guard

def is_valid_dataset_type(dataset_type: str) -> bool:
    return dataset_type in DATASET_TYPES or dataset_type in config_registry.RANKING_DATASET_FACTORIES

Try / catch

try:
    ds = _make_dataset(mparams, dataset_type, hash_table, config_name)
except ValueError as e:
    if "dataset_type" in str(e):
        raise SystemExit(f"Bad dataset_type; pick from {DATASET_TYPES}") from e
    raise

Prevention

When it happens

Trigger: Calling _make_dataset with a dataset_type not in DATASET_TYPES and not registered in config_registry.RANKING_DATASET_FACTORIES — e.g. 'Aggregated_Kafka' (wrong case), 'kafka' (shorthand), or a new unregistered type.

Common situations: Typos or case mismatch in the config's dataset_type; using a dataset type introduced in a newer version while running older code; renaming a dataset type and missing a call site; custom dataset registered under a different registry key.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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