{"record":{"id":"e8f6ba28d5e8d2cb","repo":"Unity-Technologies/ml-agents","slug":"the-trainer-was-unable-to-process-any-of-the-provi","errorCode":null,"errorMessage":"The trainer was unable to process any of the provided inputs. Make sure the trained agents has at least one sensor attached to them.","messagePattern":"The trainer was unable to process any of the provided inputs\\. Make sure the trained agents has at least one sensor attached to them\\.","errorType":"exception","errorClass":"UnityTrainerException","httpStatus":null,"severity":"error","filePath":"ml-agents/mlagents/trainers/torch_entities/networks.py","lineNumber":144,"sourceCode":"            masks = get_zero_entities_mask([p_i[1] for p_i in var_len_processor_inputs])\n            embeddings: List[torch.Tensor] = []\n            processed_self = (\n                self.x_self_encoder(encoded_self)\n                if input_exist and self.x_self_encoder is not None\n                else None\n            )\n            for processor, var_len_input in var_len_processor_inputs:\n                embeddings.append(processor(processed_self, var_len_input))\n            qkv = torch.cat(embeddings, dim=1)\n            attention_embedding = self.rsa(qkv, masks)\n            if not input_exist:\n                encoded_self = torch.cat([attention_embedding], dim=1)\n                input_exist = True\n            else:\n                encoded_self = torch.cat([encoded_self, attention_embedding], dim=1)\n\n        if not input_exist:\n            raise UnityTrainerException(\n                \"The trainer was unable to process any of the provided inputs. \"\n                \"Make sure the trained agents has at least one sensor attached to them.\"\n            )\n\n        return encoded_self\n\n    def get_goal_encoding(self, inputs: List[torch.Tensor]) -> torch.Tensor:\n        \"\"\"\n        Encode observations corresponding to goals using a list of processors.\n        :param inputs: List of Tensors corresponding to a set of obs.\n        \"\"\"\n        encodes = []\n        for idx in self._goal_processor_indices:\n            processor = self.processors[idx]\n            if not isinstance(processor, EntityEmbedding):\n                # The input can be encoded without having to process other inputs\n                obs_input = inputs[idx]\n                processed_obs = processor(obs_input)","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents/mlagents/trainers/torch_entities/networks.py#L126-L162","documentation":"Networks.py raises UnityTrainerException in the MultiInputNetwork forward pass when, after processing all sensors, no input was actually encoded (input_exist stays False). ML-Agents requires an agent to contribute at least one sensor (visual or vector observation) so the network can build an encoding; with zero usable sensors the cat() over an empty collection would be meaningless, so the library fails fast.","triggerScenarios":"Calling forward on a network whose behavior/agent has no sensors attached (no camera SensorComponents, no vector observations), so the loop over sensors never sets input_exist=True.","commonSituations":"Training an agent whose behavior spec has zero observation sensors; a custom training script constructing a NetworkBody/actor from an empty BehaviorSpec; a Unity scene where the Behavior Parameters were set but observations were removed or the sensor registration failed.","solutions":["Attach at least one sensor (CameraSensorComponent, RenderTextureSensorComponent, or ObservationProvider) to the agent or ensure the BehaviorSpec has at least one observation spec","If using vector observations, verify the Behavior Parameters 'Vector Observation' Space Size is > 0 in Unity","Check that custom sensors are actually added to the Agent (sensors list) and are discovered by ML-Agents","Verify your training config's behavior name matches the one emitted by the environment so the correct spec with sensors is used"],"exampleFix":"// before (Python, agent setup)\nagent = Agent()\n// after\nagent = Agent()\nagent.add_component(CameraSensorComponent(...))\n# or in Unity: Behavior Parameters > Vector Observation Space Size = 8","handlingStrategy":"validation","validationCode":"from mlagents_envs.base_env import BehaviorSpec\nassert behavior_spec.observation_specs, \"Agent must have at least one observation sensor\"\nfor spec in behavior_spec.observation_specs:\n    assert spec.shape, f\"Observation {spec} has empty shape\"","typeGuard":"def has_sensors(behavior_spec) -> bool:\n    return len(behavior_spec.observation_specs) > 0","tryCatchPattern":"from mlagents.trainers.exception import UnityTrainerException\ntry:\n    encoding = network.forward(inputs)\nexcept UnityTrainerException as e:\n    logger.error(f\"Agent has no sensors: {e}\")\n    raise","preventionTips":["Always attach at least one sensor (camera or vector) to every agent","Validate the BehaviorSpec observation count before creating a trainer","In Unity, set Behavior Parameters observation space size > 0"],"tags":["python","mlagents","configuration","sensors"],"backgroundTag":"no-input-sensor-attached","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}