{"record":{"id":"8c09777aa4b4d7cb","repo":"Unity-Technologies/ml-agents","slug":"unknown-tensorproxy-expected-as-output-tensor-n","errorCode":null,"errorMessage":"Unknown tensorProxy expected as output : {tensor.name}","messagePattern":"Unknown tensorProxy expected as output : (.+?)","errorType":"exception","errorClass":"UnityAgentsException","httpStatus":null,"severity":"error","filePath":"com.unity.ml-agents/Runtime/Inference/TensorApplier.cs","lineNumber":105,"sourceCode":"        }\n\n        /// <summary>\n        /// Updates the state of the agents based on the data present in the tensor.\n        /// </summary>\n        /// <param name=\"tensors\"> Enumerable of tensors containing the data.</param>\n        /// <param name=\"actionIds\"> List of Agents Ids that will be updated using the tensor's data</param>\n        /// <param name=\"lastActions\"> Dictionary of AgentId to Actions to be updated</param>\n        /// <exception cref=\"UnityAgentsException\"> One of the tensor does not have an\n        /// associated applier.</exception>\n        public void ApplyTensors(\n            IReadOnlyList<TensorProxy> tensors, IList<int> actionIds, Dictionary<int, ActionBuffers> lastActions)\n        {\n            for (var tensorIndex = 0; tensorIndex < tensors.Count; tensorIndex++)\n            {\n                var tensor = tensors[tensorIndex];\n                if (!m_Dict.ContainsKey(tensor.name))\n                {\n                    throw new UnityAgentsException(\n                        $\"Unknown tensorProxy expected as output : {tensor.name}\");\n                }\n                m_Dict[tensor.name].Apply(tensor, actionIds, lastActions);\n            }\n        }\n    }\n}\n","sourceCodeStart":87,"sourceCodeEnd":113,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/com.unity.ml-agents/Runtime/Inference/TensorApplier.cs#L87-L113","documentation":"TensorApplier.ApplyTensors iterates the model's output tensors and looks each up by name in its internal dictionary of registered output appliers. If the model produced an output tensor whose name was not registered, the applier cannot route it to the agent, so it throws.","triggerScenarios":"Running inference with a model whose output tensor names differ from the ones TensorApplier initialized from the agent's behavior parameters (e.g. unexpected auxiliary outputs or an old/new naming convention).","commonSituations":"Using a model exported by a different ml-agents version with renamed tensor outputs; hand-modified or custom-exported ONNX models with extra/renamed outputs; mixing a newer trainer's model with an older Unity plugin.","solutions":["Use a model exported by a matching version of ml-agents (re-export with the current trainer) so output tensor names match","Check that the model's outputs correspond to action/recorder tensors the ModelRunner expects","Align com.unity.ml-agents and the ml-agents Python package versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"foreach (var outputName in modelOutputTensorNames)\n    if (!expectedOutputNames.Contains(outputName))\n        throw new InvalidOperationException($\"Model has unexpected output tensor: {outputName}\");","typeGuard":null,"tryCatchPattern":"try { tensorApplier.ApplyTensors(tensors, actionIds, lastActions); }\ncatch (UnityAgentsException e) when (e.Message.Contains(\"Unknown tensorProxy expected as output\"))\n{ Debug.LogError(\"Model output names don't match this ml-agents version — re-export the model.\"); }","preventionTips":["Re-export models with the matching ml-agents trainer version","Avoid hand-editing ONNX graph output names","Pin the Python ml-agents version to one compatible with the Unity package"],"tags":["unity","ml-agents","inference","tensor","naming-mismatch"],"backgroundTag":"model-tensor-shape-mismatch","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}