{"record":{"id":"ca89e413dcd2f47e","repo":"Unity-Technologies/ml-agents","slug":"unsupported-reward-signal-configuration-d","errorCode":null,"errorMessage":"Unsupported reward signal configuration {d}.","messagePattern":"Unsupported reward signal configuration (.+?)\\.","errorType":"validation","errorClass":"TrainerConfigError","httpStatus":null,"severity":"error","filePath":"ml-agents/mlagents/trainers/settings.py","lineNumber":210,"sourceCode":"        }\n        return _mapping[self]\n\n\n@attr.s(auto_attribs=True)\nclass RewardSignalSettings:\n    gamma: float = 0.99\n    strength: float = 1.0\n    network_settings: NetworkSettings = attr.ib(factory=NetworkSettings)\n\n    @staticmethod\n    def structure(d: Mapping, t: type) -> Any:\n        \"\"\"\n        Helper method to structure a Dict of RewardSignalSettings class. Meant to be registered with\n        cattr.register_structure_hook() and called with cattr.structure(). This is needed to handle\n        the special Enum selection of RewardSignalSettings classes.\n        \"\"\"\n        if not isinstance(d, Mapping):\n            raise TrainerConfigError(f\"Unsupported reward signal configuration {d}.\")\n        d_final: Dict[RewardSignalType, RewardSignalSettings] = {}\n        for key, val in d.items():\n            enum_key = RewardSignalType(key)\n            t = enum_key.to_settings()\n            d_final[enum_key] = strict_to_cls(val, t)\n            # Checks to see if user specifying deprecated encoding_size for RewardSignals.\n            # If network_settings is not specified, this updates the default hidden_units\n            # to the value of encoding size. If specified, this ignores encoding size and\n            # uses network_settings values.\n            if \"encoding_size\" in val:\n                logger.warning(\n                    \"'encoding_size' was deprecated for RewardSignals. Please use network_settings.\"\n                )\n                # If network settings was not specified, use the encoding size. Otherwise, use hidden_units\n                if \"network_settings\" not in val:\n                    d_final[enum_key].network_settings.hidden_units = val[\n                        \"encoding_size\"\n                    ]","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents/mlagents/trainers/settings.py#L192-L228","documentation":"This error comes from the cattr structure hook that converts the YAML `reward_signals` mapping into RewardSignalSettings objects. It is thrown when the value being structured is not a Mapping (dict), meaning the reward_signals section was written in an unsupported shape (scalar, list, string, etc.). The hook also handles Enum-keyed selection of the correct settings class, which only works on mappings.","triggerScenarios":"Writing `reward_signals: extrinsic` or `reward_signals: [extrinsic]` (non-mapping) in the trainer YAML instead of a mapping of signal name -> settings.","commonSituations":"Hand-edited YAML where the reward_signals block was accidentally flattened, or copying an old/simplified config snippet that used shorthand syntax no longer supported.","solutions":["Write reward_signals as a mapping: `reward_signals: {extrinsic: {gamma: 0.99, strength: 1.0}}`.","Check YAML indentation so each signal name maps to its own settings dict.","Validate the YAML with a parser to confirm reward_signals parses to a dict, not a scalar or list."],"exampleFix":"# before\nreward_signals: extrinsic\n\n# after\nreward_signals:\n  extrinsic:\n    gamma: 0.99\n    strength: 1.0","handlingStrategy":"validation","validationCode":"rs = cfg.get('reward_signals')\nif not isinstance(rs, dict):\n    raise ValueError('reward_signals must be a mapping of signal name -> settings dict')","typeGuard":"def is_reward_signal_config(v) -> bool:\n    return isinstance(v, dict) and all(isinstance(k, str) for k in v)","tryCatchPattern":"try:\n    config = TrainerSettings.structure(yaml.safe_load(f))\nexcept TrainerConfigError as e:\n    if 'reward signal' in str(e):\n        fix_reward_signals_block()\n    raise","preventionTips":["Always define reward signals with one indent level per signal name","Validate YAML structure with a schema before training","Copy the reward_signals block from the official example configs"],"tags":["config","yaml","reward-signals","validation"],"backgroundTag":"invalid-config-schema","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}