Unity-Technologies/ml-agents · error · UnityAgentsException
Unknown tensorProxy expected as input : {tensor.name}
Error message
Unknown tensorProxy expected as input : {tensor.name} What it means
TensorGenerator.GenerateTensors iterates the tensors the model expects as inputs and looks each up by name among the registered input generators. An input tensor name with no registered generator cannot be filled, so it throws. This is the input-side counterpart of the TensorApplier unknown-output error.
Source
Thrown at com.unity.ml-agents/Runtime/Inference/TensorGenerator.cs:172
/// Populates the data of the tensor inputs given the data contained in the current batch
/// of agents.
/// </summary>
/// <param name="tensors"> Enumerable of tensors that will be modified.</param>
/// <param name="currentBatchSize"> The number of agents present in the current batch
/// </param>
/// <param name="infos"> List of AgentsInfos and Sensors that contains the
/// data that will be used to modify the tensors</param>
/// <exception cref="UnityAgentsException"> One of the tensor does not have an
/// associated generator.</exception>
public void GenerateTensors(
IReadOnlyList<TensorProxy> tensors, int currentBatchSize, IList<AgentInfoSensorsPair> infos)
{
for (var tensorIndex = 0; tensorIndex < tensors.Count; tensorIndex++)
{
var tensor = tensors[tensorIndex];
if (!m_Dict.ContainsKey(tensor.name))
{
throw new UnityAgentsException(
$"Unknown tensorProxy expected as input : {tensor.name}");
}
m_Dict[tensor.name].Generate(tensor, currentBatchSize, infos);
}
}
}
}
View on GitHub (pinned to 3ecb446f75)
Solutions
- Re-export the model with the matching ml-agents trainer version so input names follow TensorNames conventions
- Align Agent Behavior Parameters with the model (e.g. enable memory if the model has recurrent inputs)
- Match com.unity.ml-agents and Python ml-agents package versions
Defensive patterns
Strategy: validation
Validate before calling
foreach (var inputName in modelInputTensorNames)
if (!TensorUtils.TensorNamesIncludesExpected(inputName))
throw new InvalidOperationException($"Model requires unregistered input: {inputName}"); Try / catch
try { tensorGenerator.GenerateTensors(tensors, batchSize, infos); }
catch (UnityAgentsException e) when (e.Message.Contains("Unknown tensorProxy expected as input"))
{ Debug.LogError("Model input names/names mismatch — re-export the model with the matching trainer version."); } Prevention
- Match trainer and Unity plugin versions
- Enable Agent memory only when the model has recurrent inputs (and vice versa)
- Inspect the exported model's input names against ML-Agents TensorNames conventions
When it happens
Trigger: Running inference with a model that requires an input tensor (e.g. recurrent memory, mask, or observation tensor) whose name wasn't registered during initialization — typically a naming mismatch between the model and the plugin's TensorNames conventions.
Common situations: Model exported by a different ml-agents version with renamed inputs; custom ONNX graphs with extra inputs; memory/mask tensors present in the model while the agent wasn't configured with recurrence (or vice versa).
Related errors
- Unknown tensorProxy expected as output : {tensor.name}
- Sensor {sensor.GetName()} have an invalid rank {rank}
- Only float data types are currently supported
- Can't use Behavior Type {behaviorType} without a model. Eith
- Index out of bounds, expected a number between 0 and {Length
AI-assisted analysis of Unity-Technologies/ml-agents@3ecb446f75 (2026-09-02).
Data as JSON: /api/errors/c1a9fc21d7c240d2.
Report an issue: GitHub.