{"record":{"id":"0591af88883ea616","repo":"huggingface/candle","slug":"is-a-dummy-type-and-does-not-support-parsing","errorCode":null,"errorMessage":"{} is a dummy type and does not support parsing","messagePattern":"(.+?) is a dummy type and does not support parsing","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"candle-core/src/dummy_dtype.rs","lineNumber":215,"sourceCode":"        }\n\n        impl num_traits::One for $ty {\n            fn one() -> Self {\n                panic!(\n                    \"{} is a dummy type and does not support operations\",\n                    stringify!($ty)\n                )\n            }\n        }\n\n        impl num_traits::Num for $ty {\n            type FromStrRadixErr = std::num::ParseFloatError;\n\n            fn from_str_radix(\n                _str: &str,\n                _radix: u32,\n            ) -> std::result::Result<Self, Self::FromStrRadixErr> {\n                panic!(\n                    \"{} is a dummy type and does not support parsing\",\n                    stringify!($ty)\n                )\n            }\n        }\n\n        impl crate::cpu::kernels::VecOps for $ty {\n            fn min(self, _other: Self) -> Self {\n                panic!(\n                    \"{} is a dummy type and does not support operations\",\n                    stringify!($ty)\n                )\n            }\n\n            fn max(self, _other: Self) -> Self {\n                panic!(\n                    \"{} is a dummy type and does not support operations\",\n                    stringify!($ty)","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-core/src/dummy_dtype.rs#L197-L233","documentation":"num_traits::Num::from_str_radix on candle's dummy microscaling float types (F6E2M3, F6E3M2, F4, F8E8M0) always panics instead of returning Err. The impl only exists to satisfy the Num trait's associated bounds (the declared FromStrRadixErr type is unused). Parsing a string into one of these dummy types is impossible by design.","triggerScenarios":"Calling from_str_radix::<F6E2M3, _>(...) (or the other dummy types), including generic parsers, config deserializers, or num-traits-based text parsing routed to these element types.","commonSituations":"Parsing tensor values or config parameters from text files/checkpoints with the target element type set to an experimental microscaling dtype.","solutions":["Parse into f32/f64 first, then (if a real encoding exists) convert to the target format's bit representation yourself.","Reject dummy dtypes at config/load time: validate DType against a supported list (F32/F16/BF16/F64 etc.) before parsing begins.","Handle this via DType dispatch returning Error::UnsupportedDTypeForOp rather than attempting num_traits parsing.","Use panic::catch_unwind around parsing paths where the element type is data-driven."],"exampleFix":"// before\nlet v = F6E2M3::from_str_radix(s, 10)?; // panics\n// after\nlet v: f32 = s.parse()?; // parse in a supported type","handlingStrategy":"validation","validationCode":"// parse into a supported type and validate the target dtype explicitly\nfn parse_value(s: &str, dt: DType) -> candle_core::Result<f64> {\n    if matches!(dt, DType::F6E2M3 | DType::F6E3M2 | DType::F4 | DType::F8E8M0) {\n        return Err(candle_core::Error::UnsupportedDTypeForOp(dt, \"from_str_radix\").bt());\n    }\n    s.parse::<f64>().map_err(|e| candle_core::Error::Msg(format!(\"parse: {e}\")))\n}","typeGuard":"fn is_parsable_dtype(dt: DType) -> bool {\n    !matches!(dt, DType::F6E2M3 | DType::F6E3M2 | DType::F4 | DType::F8E8M0)\n}","tryCatchPattern":"std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| T::from_str_radix(s, 10)))\n    .map_err(|_| candle_core::Error::Msg(\"dummy dtype does not support parsing\".into()))","preventionTips":["Always parse text values into f32/f64 and convert afterwards, never directly into dummy dtypes","Validate the DType from safetensors headers before any string parsing stage","Do not rely on the declared FromStrRadixErr type — the method panics instead of returning Err","Add a supported-dtype allowlist to config deserialization code"],"tags":["rust","panic","candle","num-traits","parsing","unsupported-dtype"],"backgroundTag":"unsupported-operation-on-placeholder-type","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}