{"record":{"id":"51722834149027fc","repo":"huggingface/candle","slug":"cannot-find-output","errorCode":null,"errorMessage":"cannot find output {}","messagePattern":"cannot find output (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":2574,"sourceCode":"                                    flat_output.slice_scatter(&update_slice, 0, flat_idx)?;\n                            }\n                        }\n                    }\n                }\n\n                // Reshape flat output back to original shape\n                output = flat_output.reshape(data_shape.to_vec())?;\n\n                values.insert(node.output[0].clone(), output);\n            }\n            op_type => bail!(\"unsupported op_type {op_type} for op {node:?}\"),\n        }\n    }\n    graph\n        .output\n        .iter()\n        .map(|output| match values.remove(&output.name) {\n            None => bail!(\"cannot find output {}\", output.name),\n            Some(value) => Ok((output.name.clone(), value)),\n        })\n        .collect()\n}\n\nfn broadcast_shape(shape_a: &[usize], shape_b: &[usize]) -> Result<Vec<usize>> {\n    let (longest, shortest) = if shape_a.len() > shape_b.len() {\n        (shape_a, shape_b)\n    } else {\n        (shape_b, shape_a)\n    };\n    let diff = longest.len() - shortest.len();\n    let mut target_shape = longest[0..diff].to_vec();\n    for (dim1, dim2) in longest[diff..].iter().zip(shortest.iter()) {\n        if *dim1 == *dim2 || *dim2 == 1 || *dim1 == 1 {\n            target_shape.push(usize::max(*dim1, *dim2));\n        } else {\n            bail!(","sourceCodeStart":2556,"sourceCodeEnd":2592,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L2556-L2592","documentation":"After evaluating all graph nodes, simple_eval_ looks up each declared graph output in the computed values map. If a requested output name was never produced by any node or initializer, this error is thrown. It typically indicates a mismatch between the model's declared graph.outputs and what the graph actually computes.","triggerScenarios":"Loading an ONNX model whose graph.output list references a tensor name not present in node outputs or initializers (renamed outputs, partially trimmed graphs), then calling simple_eval.","commonSituations":"Graph surgery that removed the node producing an output without updating graph.outputs; exporter bugs; manually editing output names; version changes altering output naming.","solutions":["Verify graph.output names match actual node output names (netron / onnx.checker)","Update graph.outputs after any graph trimming/editing","Re-export the model from the source framework"],"exampleFix":"# before\n# graph.output = [\"logits_old\"] but nodes produce \"logits\"\n# after\ndel graph.output[:]\ngraph.output.append(onnx.ValueInfoProto(name=\"logits\"))","handlingStrategy":"validation","validationCode":"let produced: HashSet<_> = graph.node.iter().flat_map(|n| n.output.iter()).collect();\nfor out in &graph.output {\n    if !produced.contains(&out.name) {\n        return Err(format!(\"graph output {} is never produced\", out.name));\n    }\n}","typeGuard":"fn outputs_are_produced(graph: &Graph) -> bool {\n    let produced: HashSet<&str> = graph.node.iter().flat_map(|n| n.output.iter().map(|s| s.as_str())).collect();\n    graph.output.iter().all(|o| produced.contains(o.name.as_str()))\n}","tryCatchPattern":"match eval(...) {\n    Err(e) if e.contains(\"cannot find output\") => eprintln!(\"graph.output references a non-existent tensor\"),\n    other => other,\n}","preventionTips":["Run onnx.checker / shape inference at load time","Keep graph.outputs in sync after graph surgery","Never hand-edit output names without updating nodes"],"tags":["onnx","graph","missing-output"],"backgroundTag":"missing-graph-output","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}