Unity-Technologies/ml-agents · error · UnityCommunicationException
The EnvironmentParametersChannel received a message from Uni
Error message
The EnvironmentParametersChannel received a message from Unity, this should not have happened.
What it means
EnvironmentParametersChannel is outbound-only: Python sends float parameter values to Unity; Unity should never reply on this channel. Any incoming message indicates a Unity/Python protocol mismatch, so on_message_received raises UnityCommunicationException.
Source
Thrown at ml-agents-envs/mlagents_envs/side_channel/environment_parameters_channel.py:29
You can send parameters to an environment with the command
set_float_parameter.
"""
class EnvironmentDataTypes(IntEnum):
FLOAT = 0
SAMPLER = 1
class SamplerTypes(IntEnum):
UNIFORM = 0
GAUSSIAN = 1
MULTIRANGEUNIFORM = 2
def __init__(self) -> None:
channel_id = uuid.UUID("534c891e-810f-11ea-a9d0-822485860400")
super().__init__(channel_id)
def on_message_received(self, msg: IncomingMessage) -> None:
raise UnityCommunicationException(
"The EnvironmentParametersChannel received a message from Unity, "
+ "this should not have happened."
)
def set_float_parameter(self, key: str, value: float) -> None:
"""
Sets a float environment parameter in the Unity Environment.
:param key: The string identifier of the parameter.
:param value: The float value of the parameter.
"""
msg = OutgoingMessage()
msg.write_string(key)
msg.write_int32(self.EnvironmentDataTypes.FLOAT)
msg.write_float32(value)
super().queue_message_to_send(msg)
def set_uniform_sampler_parameters(
self, key: str, min_value: float, max_value: float, seed: intView on GitHub (pinned to 3ecb446f75)
Solutions
- Match Unity ML-Agents package and Python mlagents versions.
- Remove custom Unity code that sends messages on the environment-parameters channel id.
- Update the Unity environment binary to the matching release.
- Catch UnityCommunicationException around stepping and log both tool versions.
Defensive patterns
Strategy: try-catch
Validate before calling
# EnvironmentParametersChannel is send-only; ensure Unity code never sends on # UUID 534c891e-810f-11ea-a9d0-822485860400
Try / catch
from mlagents_envs.exception import UnityCommunicationException
try:
env.step()
except UnityCommunicationException as e:
print("Unexpected message on EnvironmentParametersChannel; check versions:", e) Prevention
- Match Unity ML-Agents and Python versions
- Use only float_parameter/IntegerParameter setters from Python side
- Avoid custom Unity writes to this channel id
- Verify env binary version before training runs
When it happens
Trigger: env.step()/reset() when Unity sends data on channel UUID 534c891e-810f-11ea-a9d0-822485860400 (e.g. custom Unity code or wrong version writing environment parameters back).
Common situations: Version-skewed ML-Agents Unity package vs Python package; custom environment code mistakenly sending on this channel id.
Related errors
- There was a problem reading a message in a SideChannel. Plea
- The DefaultTrainingAnalyticsSideChannel received a message f
- The EngineConfigurationChannel received a message from Unity
- There was a problem reading a message in a SideChannel. Plea
- The message received by the side channel {} was unexpectedly
AI-assisted analysis of Unity-Technologies/ml-agents@3ecb446f75 (2026-09-02).
Data as JSON: /api/errors/0c724c7bd4e06bbf.
Report an issue: GitHub.