{"record":{"id":"d46b1411a4a72c3b","repo":"huggingface/candle","slug":"is-a-dummy-type-and-does-not-support-storage","errorCode":null,"errorMessage":"{} is a dummy type and does not support storage","messagePattern":"(.+?) is a dummy type and does not support storage","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-core/src/dummy_dtype.rs","lineNumber":56,"sourceCode":"                )\n            }\n\n            fn to_f64(self) -> f64 {\n                panic!(\n                    \"{} is a dummy type and cannot be converted\",\n                    stringify!($ty)\n                )\n            }\n\n            fn to_scalar(self) -> crate::scalar::Scalar {\n                panic!(\n                    \"{} is a dummy type and cannot be converted to scalar\",\n                    stringify!($ty)\n                )\n            }\n\n            fn cpu_storage_ref(_data: &[Self]) -> crate::CpuStorageRef<'_> {\n                panic!(\n                    \"{} is a dummy type and does not support storage\",\n                    stringify!($ty)\n                )\n            }\n\n            fn to_cpu_storage_owned(_data: Vec<Self>) -> crate::CpuStorage {\n                panic!(\n                    \"{} is a dummy type and does not support storage\",\n                    stringify!($ty)\n                )\n            }\n\n            fn cpu_storage_data(_s: crate::CpuStorage) -> Result<Vec<Self>> {\n                Err(Error::UnsupportedDTypeForOp(DType::$dtype, \"cpu_storage_data\").bt())\n            }\n\n            fn cpu_storage_as_slice(_s: &crate::CpuStorage) -> Result<&[Self]> {\n                Err(Error::UnsupportedDTypeForOp(DType::$dtype, \"cpu_storage_as_slice\").bt())","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-core/src/dummy_dtype.rs#L38-L74","documentation":"Dummy types' WithDType::cpu_storage_ref panics because F6E2M3, F6E3M2, F4 and F8E8M0 have no CPU storage representation in candle-core; they exist only as dtype metadata for unimplemented safetensors formats. Borrowing a slice of dummy-typed data as CpuStorageRef is therefore impossible.","triggerScenarios":"Calling WithDType::cpu_storage_ref::<F6E2M3|F6E3M2|F4|F8E8M0>, typically from generic CPU kernel code that wraps &[T] into a CpuStorageRef for a tensor with a dummy dtype.","commonSituations":"Running CPU ops (map, unary/binary kernels) on tensors whose dtype is an experimental MX format loaded from a checkpoint; generic device storage code paths.","solutions":["Do not run CPU kernels on dummy-dtype tensors; convert to a supported dtype first (to_dtype(DType::F32)).","Validate the source dtype when loading safetensors and reject F6E2M3/F6E3M2/F4/F8E8M0.","Keep such tensors on paths that only inspect DTYPE metadata, never touch storage.","Patch candle to add real storage support for the MX formats if needed."],"exampleFix":"// before\ncpu_op::<F4>(&tensor); // panics in cpu_storage_ref\n// after\nlet t = tensor.to_dtype(DType::F32)?; // convert before CPU kernels\ncpu_op::<f32>(&t);","handlingStrategy":"validation","validationCode":"fn run_cpu_op(t: &Tensor) -> Result<()> {\n    if !is_supported_dtype(t.dtype()) {\n        return Err(Error::UnsupportedDTypeForOp(t.dtype(), \"cpu op\").bt());\n    }\n    Ok(())\n}","typeGuard":"fn is_supported_dtype(dtype: DType) -> bool {\n    !matches!(dtype, DType::F6E2M3 | DType::F6E3M2 | DType::F4 | DType::F8E8M0)\n}","tryCatchPattern":"let r = std::panic::catch_unwind(|| <F4 as WithDType>::cpu_storage_ref(&data));\nif r.is_err() { eprintln!(\"dummy dtype has no CPU storage\"); }","preventionTips":["Convert to a supported dtype before CPU kernels","Validate safetensors dtypes at load time and reject MX placeholders","Only read DTYPE metadata from dummy-dtype tensors; never touch storage","Prefer ops that return Error::UnsupportedDTypeForOp over panicking value paths"],"tags":["rust","panic","unsupported-dtype","storage","candle"],"backgroundTag":"unsupported-dtype","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}