huggingface/candle · critical
{} is a dummy type and does not support parsing
Error message
{} is a dummy type and does not support parsing What it means
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.
Source
Thrown at candle-core/src/dummy_dtype.rs:215
}
impl num_traits::One for $ty {
fn one() -> Self {
panic!(
"{} is a dummy type and does not support operations",
stringify!($ty)
)
}
}
impl num_traits::Num for $ty {
type FromStrRadixErr = std::num::ParseFloatError;
fn from_str_radix(
_str: &str,
_radix: u32,
) -> std::result::Result<Self, Self::FromStrRadixErr> {
panic!(
"{} is a dummy type and does not support parsing",
stringify!($ty)
)
}
}
impl crate::cpu::kernels::VecOps for $ty {
fn min(self, _other: Self) -> Self {
panic!(
"{} is a dummy type and does not support operations",
stringify!($ty)
)
}
fn max(self, _other: Self) -> Self {
panic!(
"{} is a dummy type and does not support operations",
stringify!($ty)View on GitHub (pinned to d5fee525bf)
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.
Example fix
// before let v = F6E2M3::from_str_radix(s, 10)?; // panics // after let v: f32 = s.parse()?; // parse in a supported type
Defensive patterns
Strategy: validation
Validate before calling
// parse into a supported type and validate the target dtype explicitly
fn parse_value(s: &str, dt: DType) -> candle_core::Result<f64> {
if matches!(dt, DType::F6E2M3 | DType::F6E3M2 | DType::F4 | DType::F8E8M0) {
return Err(candle_core::Error::UnsupportedDTypeForOp(dt, "from_str_radix").bt());
}
s.parse::<f64>().map_err(|e| candle_core::Error::Msg(format!("parse: {e}")))
} Type guard
fn is_parsable_dtype(dt: DType) -> bool {
!matches!(dt, DType::F6E2M3 | DType::F6E3M2 | DType::F4 | DType::F8E8M0)
} Try / catch
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| T::from_str_radix(s, 10)))
.map_err(|_| candle_core::Error::Msg("dummy dtype does not support parsing".into())) Prevention
- 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
When it happens
Trigger: 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.
Common situations: Parsing tensor values or config parameters from text files/checkpoints with the target element type set to an experimental microscaling dtype.
Related errors
- {} is a dummy type and cannot be constructed
- {} is a dummy type and cannot be converted
- {} is a dummy type and cannot be converted to scalar
- {} is a dummy type and does not support storage
- {} is a dummy type and does not support operations
AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02).
Data as JSON: /api/errors/0591af88883ea616.
Report an issue: GitHub.