{"record":{"id":"0a3163224326d5ba","repo":"exo-explore/exo","slug":"unsupported-mlx-dtype-for-wire-t-dtype","errorCode":null,"errorMessage":"Unsupported mlx dtype for wire: {t.dtype}","messagePattern":"Unsupported mlx dtype for wire: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/exo/worker/engines/mlx/disaggregated/adapter.py","lineNumber":65,"sourceCode":"        if keys.dtype in _MX_TO_STR:\n            return _MX_TO_STR[keys.dtype]\n        break\n    return \"bfloat16\"\n\n\ndef str_to_mx_dtype(dtype: DType) -> mx.Dtype:\n    if dtype not in _STR_TO_MX:\n        raise ValueError(f\"Unsupported wire dtype: {dtype!r}\")\n    return _STR_TO_MX[dtype]\n\n\ndef array_to_bytes(t: mx.array) -> bytes:\n    # bf16 has no native numpy dtype; bitcast through uint16.\n    if t.dtype == mx.bfloat16:\n        return np.asarray(t.view(mx.uint16)).tobytes()\n    if t.dtype in (mx.float16, mx.float32):\n        return np.asarray(t).tobytes()\n    raise ValueError(f\"Unsupported mlx dtype for wire: {t.dtype}\")\n\n\ndef bytes_to_array(data: bytes, shape: tuple[int, ...], dtype: DType) -> mx.array:\n    match dtype:\n        case \"bfloat16\":\n            arr = np.frombuffer(data, dtype=np.uint16).reshape(shape).copy()\n            return mx.array(arr).view(mx.bfloat16)\n        case \"float16\":\n            arr = np.frombuffer(data, dtype=np.float16).reshape(shape).copy()\n            return mx.array(arr)\n        case \"float32\":\n            arr = np.frombuffer(data, dtype=np.float32).reshape(shape).copy()\n            return mx.array(arr)\n\n\ndef bhsd_to_nhd(t: mx.array) -> mx.array:\n    if t.ndim != 4 or int(t.shape[0]) != 1:\n        raise ValueError(f\"Expected BHSD with B=1, got shape={tuple(t.shape)}\")","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/exo-explore/exo/blob/21a54c5ea0230a3bec1e1a786d200126c7e34ec6/src/exo/worker/engines/mlx/disaggregated/adapter.py#L47-L83","documentation":"Error \"Unsupported mlx dtype for wire: {t.dtype}\" thrown in exo-explore/exo.","triggerScenarios":"Thrown at src/exo/worker/engines/mlx/disaggregated/adapter.py:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"21a54c5ea0230a3bec1e1a786d200126c7e34ec6","analyzedAt":"2026-08-26T00:02:16.033Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}