{"record":{"id":"cad9292dabe72103","repo":"xai-org/x-algorithm","slug":"name-bit-idx-outside-vocab-vocab","errorCode":null,"errorMessage":"{name}: bit {idx} outside vocab {vocab}","messagePattern":"(.+?): bit (.+?) outside vocab (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/data/conversion_labels.py","lineNumber":120,"sourceCode":"    )\n    mask_name = next(\n        (n for n in (\"newEventMask\", \"newEventMaskSeq\") if n in batch.schema.names), None\n    )\n    if mask_name is None:\n        raise ValueError(\"batch missing newEventMask; conversion-label folding is candidate-only\")\n    mask_col = batch.column(mask_name)\n    is_candidate = (\n        mask_col.flatten()\n        .to_numpy(zero_copy_only=False)\n        .astype(np.bool_)\n        .reshape(batch.num_rows, mask_col.type.list_size)\n    )\n    if is_candidate.shape[1] != seq_len:\n        raise ValueError(f\"{mask_name}: seq len {is_candidate.shape[1]} != multi-hot {seq_len}\")\n    for name in action_cols:\n        idx = action_index_of(name)\n        if idx >= vocab:\n            raise ValueError(f\"{name}: bit {idx} outside vocab {vocab}\")\n        delays_col = batch.column(name)\n        delays = (\n            delays_col.flatten()\n            .to_numpy(zero_copy_only=False)\n            .astype(np.int64)\n            .reshape(batch.num_rows, delays_col.type.list_size)\n        )\n        if delays.shape[1] != seq_len:\n            raise ValueError(f\"{name}: seq len {delays.shape[1]} != multi-hot {seq_len}\")\n        bits[:, :, idx] = np.where(\n            is_candidate, delays_to_labels(delays, window_ms), bits[:, :, idx]\n        )\n    inner = pa.FixedSizeListArray.from_arrays(pa.array(bits.reshape(-1)), vocab)\n    outer = pa.FixedSizeListArray.from_arrays(inner, seq_len)\n    return batch.set_column(col_idx, batch.schema.field(col_idx), outer)\n\n\ndef delays_to_labels(delays: np.ndarray, window_ms: int) -> np.ndarray:","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/data/conversion_labels.py#L102-L138","documentation":"Each action-delay column encodes an action index parsed from its name via action_index_of(). That index must be a valid bit position within the multi-hot vocabulary size (value_type.list_size). If idx >= vocab, writing bits[:,:,:,idx] would be out of bounds, so ValueError is raised.","triggerScenarios":"Sidecar/dataset generated with a larger action vocabulary (e.g. 64 actions) but the batch's multi-hot value_type only has list_size 32; column named with a stale action index after vocab pruning.","commonSituations":"Vocabulary size changed between the labeling job and the feature pipeline; reusing old delay columns against a new multi-hot schema.","solutions":["Regenerate the multi-hot column with a vocabulary at least as large as the largest action index.","Drop action-delay columns whose index exceeds the current vocab.","Regenerate sidecars consistent with the current action vocabulary."],"exampleFix":"// before: action_delay_40 but vocab 32\nfold_action_delays_into_multihot(batch, w)  # ValueError\n\n// after: vocab 64 multihot (or drop col)\naction_cols = [c for c in cols if action_index_of(c) < vocab]\nfold_action_delays_into_multihot(batch_with_v64, w)","handlingStrategy":"validation","validationCode":"from phoenix.xrex.data import conversion_labels as cl\nvocab = mh_type.value_type.list_size\nbad = [n for n in action_cols if cl.action_index_of(n) >= vocab]\nif bad: raise SystemExit(f'action columns outside vocab: {bad}')","typeGuard":null,"tryCatchPattern":"try:\n    batch = fold_action_delays_into_multihot(batch, w)\nexcept ValueError as e:\n    if 'outside vocab' in str(e):\n        drop_offending_columns_and_retry()\n    else:\n        raise","preventionTips":["Version the action vocabulary and embed its size in dataset metadata.","Validate column-name-derived indices against vocab at sidecar generation time."],"tags":["vocabulary","index-out-of-range","conversion-labels"],"backgroundTag":"index-out-of-bounds","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}