{"record":{"id":"8143feb8ee3a00f2","repo":"xai-org/x-algorithm","slug":"name-seq-len-delays-shape-1-multi-hot-se","errorCode":null,"errorMessage":"{name}: seq len {delays.shape[1]} != multi-hot {seq_len}","messagePattern":"(.+?): seq len (.+?) != multi-hot (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/data/conversion_labels.py","lineNumber":129,"sourceCode":"        .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:\n    if window_ms < 0:\n        raise ValueError(f\"window_ms must be >= 0, got {window_ms}\")\n    return (delays >= 0) & (delays <= window_ms)\n","sourceCodeStart":111,"sourceCodeEnd":142,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/data/conversion_labels.py#L111-L142","documentation":"Each action-delay column is a FixedSizeListArray whose list_size (per-row delay vector length) must equal the multi-hot sequence length. If reshaping yields a different second dimension, the fold would misalign positions, so ValueError names the column and both lengths.","triggerScenarios":"Delay sidecar written with per-row vectors of length 16 while the multi-hot seq len is 64; delay columns attached with a stale FixedSizeList width after seq length changed.","commonSituations":"Sequence-length migration between pipeline versions; sidecars built from a dataset with different windowing.","solutions":["Regenerate sidecar delay columns with vectors matching the current sequence length.","Re-attach delay columns using the correct FixedSizeList width.","Skip the offending column until sidecars are rebuilt."],"exampleFix":"// before: delays width 16, multihot seq 64\nfold_action_delays_into_multihot(batch, w)  # ValueError\n\n// after: regenerate sidecar with width == seq len (64)\nfold_action_delays_into_multihot(batch_fixed, w)","handlingStrategy":"validation","validationCode":"for n in action_cols:\n    if batch.column(n).type.list_size != seq_len:\n        raise SystemExit(f'{n} delay width mismatch; regenerate sidecar')","typeGuard":null,"tryCatchPattern":"try:\n    batch = fold_action_delays_into_multihot(batch, w)\nexcept ValueError as e:\n    logger.error('delay width mismatch: %s', e); raise","preventionTips":["Write sidecar delay vectors with width equal to the sequence length by construction.","Add a CI schema test comparing sidecar FixedSizeList widths to the batch schema."],"tags":["shape-mismatch","sequence-length","conversion-labels"],"backgroundTag":"data-shape-mismatch","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}