{"record":{"id":"9743e177f2b92eab","repo":"Unity-Technologies/ml-agents","slug":"num-areas-must-be-set-to-a-positive-number-1","errorCode":null,"errorMessage":"num_areas must be set to a positive number >= 1.","messagePattern":"num_areas must be set to a positive number >= 1\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"ml-agents/mlagents/trainers/settings.py","lineNumber":836,"sourceCode":"    num_envs: int = attr.ib(default=parser.get_default(\"num_envs\"))\n    num_areas: int = attr.ib(default=parser.get_default(\"num_areas\"))\n    timeout_wait: int = attr.ib(default=parser.get_default(\"timeout_wait\"))\n    seed: int = parser.get_default(\"seed\")\n    max_lifetime_restarts: int = parser.get_default(\"max_lifetime_restarts\")\n    restarts_rate_limit_n: int = parser.get_default(\"restarts_rate_limit_n\")\n    restarts_rate_limit_period_s: int = parser.get_default(\n        \"restarts_rate_limit_period_s\"\n    )\n\n    @num_envs.validator\n    def validate_num_envs(self, attribute, value):\n        if value > 1 and self.env_path is None:\n            raise ValueError(\"num_envs must be 1 if env_path is not set.\")\n\n    @num_areas.validator\n    def validate_num_area(self, attribute, value):\n        if value <= 0:\n            raise ValueError(\"num_areas must be set to a positive number >= 1.\")\n\n\n@attr.s(auto_attribs=True)\nclass EngineSettings:\n    width: int = parser.get_default(\"width\")\n    height: int = parser.get_default(\"height\")\n    quality_level: int = parser.get_default(\"quality_level\")\n    time_scale: float = parser.get_default(\"time_scale\")\n    target_frame_rate: int = parser.get_default(\"target_frame_rate\")\n    capture_frame_rate: int = parser.get_default(\"capture_frame_rate\")\n    no_graphics: bool = parser.get_default(\"no_graphics\")\n    no_graphics_monitor: bool = parser.get_default(\"no_graphics_monitor\")\n\n\n@attr.s(auto_attribs=True)\nclass TorchSettings:\n    device: Optional[str] = parser.get_default(\"device\")\n","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents/mlagents/trainers/settings.py#L818-L854","documentation":"A validator on the num_areas attribute of the environment settings rejects the configured value: num_areas must be an integer >= 1 because it tells the trainer how many Area agents to expect in the environment. It fires when the YAML config or CLI default supplies zero, a negative number, or a non-positive value, making per-area worker/scaling logic impossible.","triggerScenarios":"Thrown at ml-agents/mlagents/trainers/settings.py:836 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set num_areas in the environment_settings section of your training config YAML to the actual number of areas in your Unity scene (>= 1)","If your environment has a single area, explicitly set num_areas: 1","Ensure the value is an integer, not a float or string"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}