huggingface/candle · error
unsupported op_type {op_type} for op {node:?}
Error message
unsupported op_type {op_type} for op {node:?} What it means
simple_eval_ dispatches on node op_type inside a match; the final arm catches any operator type the evaluator does not implement and bails with this message, including the node debug dump. It means the ONNX model uses an operator candle-onnx has no eval support for.
Source
Thrown at candle-onnx/src/eval.rs:2567
flat_output = flat_output.slice_scatter(
&update_slice.unsqueeze(0)?,
0,
flat_idx,
)?;
} else {
flat_output =
flat_output.slice_scatter(&update_slice, 0, flat_idx)?;
}
}
}
}
// Reshape flat output back to original shape
output = flat_output.reshape(data_shape.to_vec())?;
values.insert(node.output[0].clone(), output);
}
op_type => bail!("unsupported op_type {op_type} for op {node:?}"),
}
}
graph
.output
.iter()
.map(|output| match values.remove(&output.name) {
None => bail!("cannot find output {}", output.name),
Some(value) => Ok((output.name.clone(), value)),
})
.collect()
}
fn broadcast_shape(shape_a: &[usize], shape_b: &[usize]) -> Result<Vec<usize>> {
let (longest, shortest) = if shape_a.len() > shape_b.len() {
(shape_a, shape_b)
} else {
(shape_b, shape_a)
};View on GitHub (pinned to d5fee525bf)
Solutions
- Check the listed op_type against candle-onnx's supported ops and implement it in eval.rs
- Simplify/export the model avoiding unsupported ops (opset downgrade, operator replacement via onnx-surgement)
- Run inference with onnxruntime for models with unsupported ops
- Contribute/patch the missing op and rebuild candle-onnx
Example fix
// eval.rs
op_type => bail!("unsupported op_type {op_type} for op {node:?}"),
// after: add an arm
"Clip" => { /* implement clip */ } Defensive patterns
Strategy: try-catch
Validate before calling
const SUPPORTED: &[&str] = &["Add","Mul","Resize","Trilu","ScatterND" /* ... */];
for node in &graph.node {
if !SUPPORTED.contains(&node.op_type.as_str()) {
return Err(format!("unsupported op: {}", node.op_type));
}
} Type guard
fn all_ops_supported(graph: &Graph) -> bool {
graph.node.iter().all(|n| SUPPORTED.contains(&n.op_type.as_str()))
} Try / catch
match eval(model, inputs) {
Err(e) if e.starts_with("unsupported op_type") => run_with_onnxruntime(model, inputs),
other => other,
} Prevention
- Audit model opsets against candle-onnx's supported ops list before inference
- Avoid control-flow ops (If/Loop/Scan) when targeting candle-onnx
- Keep the supported-op list in CI as a lint step
When it happens
Trigger: Running any model containing an op_type not covered by the match arms in simple_eval_ (e.g. newer or less common ONNX ops like RandomNormalLike, Loop, If, custom domains).
Common situations: Using models with control-flow ops (Loop/If/Scan) or ops added in newer opsets than the evaluator supports; custom-operator domains from framework-specific exporters.
Related errors
- attribute {} was of type TENSOR, but no tensor was found
- attribute {} of type TENSOR was an invalid data_type number
- attribute {} of type TENSOR has an unsupported data_type {}
- attribute {} of type TENSOR has a negative dimension, which
- cannot find the '{name}' attribute in '{}' for {}
AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02).
Data as JSON: /api/errors/e150492964eb0c64.
Report an issue: GitHub.