{"record":{"id":"9a2d226e68fdd342","repo":"Unity-Technologies/ml-agents","slug":"unsupported-config-d-for-t-name","errorCode":null,"errorMessage":"Unsupported config {d} for {t.__name__}.","messagePattern":"Unsupported config (.+?) for (.+?)\\.","errorType":"validation","errorClass":"TrainerConfigError","httpStatus":null,"severity":"error","filePath":"ml-agents/mlagents/trainers/settings.py","lineNumber":63,"sourceCode":"    return cattr.structure(value, attr_fields_dict[key].type)\n\n\ndef check_hyperparam_schedules(val: Dict, trainer_type: str) -> Dict:\n    # Check if beta and epsilon are set. If not, set to match learning rate schedule.\n    if trainer_type == \"ppo\" or trainer_type == \"poca\":\n        if \"beta_schedule\" not in val.keys() and \"learning_rate_schedule\" in val.keys():\n            val[\"beta_schedule\"] = val[\"learning_rate_schedule\"]\n        if (\n            \"epsilon_schedule\" not in val.keys()\n            and \"learning_rate_schedule\" in val.keys()\n        ):\n            val[\"epsilon_schedule\"] = val[\"learning_rate_schedule\"]\n    return val\n\n\ndef strict_to_cls(d: Mapping, t: type) -> Any:\n    if not isinstance(d, Mapping):\n        raise TrainerConfigError(f\"Unsupported config {d} for {t.__name__}.\")\n    d_copy: Dict[str, Any] = {}\n    d_copy.update(d)\n    for key, val in d_copy.items():\n        d_copy[key] = check_and_structure(key, val, t)\n    return t(**d_copy)\n\n\ndef defaultdict_to_dict(d: DefaultDict) -> Dict:\n    return {key: cattr.unstructure(val) for key, val in d.items()}\n\n\ndef deep_update_dict(d: Dict, update_d: Mapping) -> None:\n    \"\"\"\n    Similar to dict.update(), but works for nested dicts of dicts as well.\n    \"\"\"\n    for key, val in update_d.items():\n        if key in d and isinstance(d[key], Mapping) and isinstance(val, Mapping):\n            deep_update_dict(d[key], val)","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents/mlagents/trainers/settings.py#L45-L81","documentation":"TrainerConfigError raised by strict_to_cls when the value being structured into a settings class is not a Mapping (dict). The YAML deserializer expects every config section (trainer settings, hyperparameters, reward signals) to be a dict of keys; if a scalar, string, or list is supplied where a mapping is required, conversion to the attrs class fails.","triggerScenarios":"A YAML section given a non-dict value, e.g. hyperparameters: 123, reward_signals: extrinsic, or a reward signal entry like extrinsic: 1.0 instead of extrinsic: {strength: 1.0}; also mis-indented YAML that collapses a section into a string.","commonSituations":"YAML indentation errors that turn a nested block into a scalar; hand-written configs where reward signals or network_settings were written as bare scalars; programmatic config building passing a list instead of a dict.","solutions":["Ensure the flagged section is a YAML mapping: use key: value pairs under the section header, not a bare scalar or list.","Fix indentation so nested sections (hyperparameters, network_settings, reward_signals) contain sub-keys as dicts.","Write reward signal entries as mappings: extrinsic:\\n  strength: 1.0, not extrinsic: 1.0.","Validate the YAML parses as expected with a quick python -c \"import yaml; print(yaml.safe_load(open('config.yaml')))\"."],"exampleFix":"# before\nreward_signals:\n  extrinsic: 1.0\n# after\nreward_signals:\n  extrinsic:\n    gamma: 0.99\n    strength: 1.0","handlingStrategy":"validation","validationCode":"import yaml\nraw = yaml.safe_load(open(\"config.yaml\"))\nfor section in (\"hyperparameters\", \"network_settings\", \"reward_signals\"):\n    val = raw.get(section)\n    if val is not None and not isinstance(val, dict):\n        raise ValueError(f\"Section '{section}' must be a YAML mapping, got {type(val).__name__}\")","typeGuard":"from typing import Mapping\ndef is_mapping_config(v) -> bool:\n    return isinstance(v, Mapping)","tryCatchPattern":"from mlagents.trainers.exception import TrainerConfigError\ntry:\n    settings = load_config(\"config.yaml\")\nexcept TrainerConfigError as e:\n    logger.error(f\"Config section is not a mapping: {e}\")\n    raise SystemExit(1)","preventionTips":["Verify YAML indentation — nested sections must be indented under their parent key","Write reward signal entries as mappings with strength/gamma sub-keys, never bare scalars","Round-trip the YAML through yaml.safe_load and inspect types before training"],"tags":["ml-agents","configuration","yaml","schema-validation","type-error"],"backgroundTag":"invalid-config-schema","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}