{"record":{"id":"0c724c7bd4e06bbf","repo":"Unity-Technologies/ml-agents","slug":"the-environmentparameterschannel-received-a-messag","errorCode":null,"errorMessage":"The EnvironmentParametersChannel received a message from Unity, this should not have happened.","messagePattern":"The EnvironmentParametersChannel received a message from Unity, this should not have happened\\.","errorType":"exception","errorClass":"UnityCommunicationException","httpStatus":null,"severity":"error","filePath":"ml-agents-envs/mlagents_envs/side_channel/environment_parameters_channel.py","lineNumber":29,"sourceCode":"    You can send parameters to an environment with the command\n    set_float_parameter.\n    \"\"\"\n\n    class EnvironmentDataTypes(IntEnum):\n        FLOAT = 0\n        SAMPLER = 1\n\n    class SamplerTypes(IntEnum):\n        UNIFORM = 0\n        GAUSSIAN = 1\n        MULTIRANGEUNIFORM = 2\n\n    def __init__(self) -> None:\n        channel_id = uuid.UUID(\"534c891e-810f-11ea-a9d0-822485860400\")\n        super().__init__(channel_id)\n\n    def on_message_received(self, msg: IncomingMessage) -> None:\n        raise UnityCommunicationException(\n            \"The EnvironmentParametersChannel received a message from Unity, \"\n            + \"this should not have happened.\"\n        )\n\n    def set_float_parameter(self, key: str, value: float) -> None:\n        \"\"\"\n        Sets a float environment parameter in the Unity Environment.\n        :param key: The string identifier of the parameter.\n        :param value: The float value of the parameter.\n        \"\"\"\n        msg = OutgoingMessage()\n        msg.write_string(key)\n        msg.write_int32(self.EnvironmentDataTypes.FLOAT)\n        msg.write_float32(value)\n        super().queue_message_to_send(msg)\n\n    def set_uniform_sampler_parameters(\n        self, key: str, min_value: float, max_value: float, seed: int","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents-envs/mlagents_envs/side_channel/environment_parameters_channel.py#L11-L47","documentation":"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.","triggerScenarios":"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).","commonSituations":"Version-skewed ML-Agents Unity package vs Python package; custom environment code mistakenly sending on this channel id.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# EnvironmentParametersChannel is send-only; ensure Unity code never sends on\n# UUID 534c891e-810f-11ea-a9d0-822485860400","typeGuard":null,"tryCatchPattern":"from mlagents_envs.exception import UnityCommunicationException\ntry:\n    env.step()\nexcept UnityCommunicationException as e:\n    print(\"Unexpected message on EnvironmentParametersChannel; check versions:\", e)","preventionTips":["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"],"tags":["unity","side-channel","version-mismatch"],"backgroundTag":"side-channel-version-mismatch","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}