huggingface/candle · error
unsupported 'value' data-type {dt:?} for {}
Error message
unsupported 'value' data-type {dt:?} for {} What it means
During input validation in simple_eval_, the declared elem_type maps to a valid ONNX DataType but candle's dtype() returns None — meaning ONNX knows the element type but candle-onnx has no corresponding DType (or it is intentionally unsupported). The library refuses to build an input tensor of that type.
Source
Thrown at candle-onnx/src/eval.rs:280
};
let input_type = match &input_type.value {
Some(input_type) => input_type,
None => continue,
};
let tensor_type = match input_type {
onnx::type_proto::Value::TensorType(tt) => tt,
_ => continue,
};
let tensor = match values.get(&input.name) {
None => bail!("missing input {}", input.name),
Some(tensor) => tensor,
};
let dt = match DataType::try_from(tensor_type.elem_type) {
Ok(dt) => match dtype(dt) {
Some(dt) => dt,
None => {
bail!("unsupported 'value' data-type {dt:?} for {}", input.name)
}
},
type_ => bail!("unsupported input type {type_:?}"),
};
match &tensor_type.shape {
None => continue,
Some(shape) => {
if shape.dim.len() != tensor.rank() {
bail!(
"unexpected rank for {}, got {:?}, expected {:?}",
input.name,
shape.dim,
tensor.shape()
)
}
for (idx, (d, &dim)) in shape.dim.iter().zip(tensor.dims().iter()).enumerate() {
match &d.value {
Some(onnx::tensor_shape_proto::dimension::Value::DimValue(v)) => {View on GitHub (pinned to d5fee525bf)
Solutions
- Cast the input tensor to a supported dtype (f32/i64) and re-run eval.
- Re-export the model with a supported elem_type for its inputs.
- Check the candle-onnx version's supported dtype list; upgrade if a newer version adds the type.
- If the input is unused by the graph, remove it from the model's input list during export (non-optional inputs are validated).
Example fix
// before let v = Tensor::from_vec(bf16_data, shape)?; // bfloat16 input // after let v = Tensor::from_vec(bf16_data.to_f32v(), shape)?; // cast to f32
Defensive patterns
Strategy: type-guard
Validate before calling
fn input_dtypes_supported(model: &onnx::ModelProto) -> bool {
model.graph.as_ref().map_or(true, |g| g.input.iter().all(|i| {
match &i.r#type.value {
Some(onnx::type_proto::Value::TensorType(tt)) =>
candle_onnx::DataType::try_from(tt.elem_type)
.ok()
.and_then(candle_onnx::eval::dtype)
.is_some(),
_ => true,
}
}))
} Type guard
fn has_candle_dtype(elem_type: i32) -> bool {
use candle_onnx::DataType;
DataType::try_from(elem_type).ok()
.and_then(candle_onnx::eval::dtype)
.is_some()
} Try / catch
match simple_eval(&model, inputs) {
Err(e) if e.to_string().contains("unsupported 'value' data-type") => {
anyhow::bail!("convert inputs to a supported dtype (f32/i64) before eval")
}
r => r?,
} Prevention
- Cast inputs to f32/i64 before eval
- Avoid models with bf16/f16/string/graph inputs unless supported
- Check supported dtypes for your candle-onnx version
- Re-export with standard elem_types
When it happens
Trigger: Supplying inputs to simple_eval where a graph input is declared with an element type known to ONNX but unsupported by candle-onnx (e.g. float8, bfloat16 depending on version, string, complex types).
Common situations: Feeding bf16 tensors to a candle-onnx build lacking bf16 support; string inputs (tokenizers sometimes declare string inputs); models from exporters using newer type sets.
Related errors
- unsupported 'value' data-type {} for {name}
- attribute {} of type TENSOR was an invalid data_type number
- attribute {} of type TENSOR has an unsupported data_type {}
- unsupported 'value' data-type {dt:?} for {name}
- missing input {}
AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02).
Data as JSON: /api/errors/ac2006fb5b710f73.
Report an issue: GitHub.