{"record":{"id":"e96d3e53d9bc9a3a","repo":"Unity-Technologies/ml-agents","slug":"settings-for-trainer-type-d-copy-trainer-type","errorCode":null,"errorMessage":"Settings for trainer type {d_copy['trainer_type']} were not found","messagePattern":"Settings for trainer type (.+?) were not found","errorType":"validation","errorClass":"TrainerConfigError","httpStatus":null,"severity":"error","filePath":"ml-agents/mlagents/trainers/settings.py","lineNumber":711,"sourceCode":"        for key, val in d_copy.items():\n            if attr.has(type(val)):\n                # Don't convert already-converted attrs classes.\n                continue\n            if key == \"hyperparameters\":\n                if \"trainer_type\" not in d_copy:\n                    raise TrainerConfigError(\n                        \"Hyperparameters were specified but no trainer_type was given.\"\n                    )\n                else:\n                    d_copy[key] = check_hyperparam_schedules(\n                        val, d_copy[\"trainer_type\"]\n                    )\n                    try:\n                        d_copy[key] = strict_to_cls(\n                            d_copy[key], all_trainer_settings[d_copy[\"trainer_type\"]]\n                        )\n                    except KeyError:\n                        raise TrainerConfigError(\n                            f\"Settings for trainer type {d_copy['trainer_type']} were not found\"\n                        )\n            elif key == \"max_steps\":\n                d_copy[key] = int(float(val))\n                # In some legacy configs, max steps was specified as a float\n            # elif key == \"even_checkpoints\":\n            #     if val:\n            #         d_copy[\"checkpoint_interval\"] = int(d_copy[\"max_steps\"] / d_copy[\"keep_checkpoints\"])\n            elif key == \"trainer_type\":\n                if val not in all_trainer_types.keys():\n                    raise TrainerConfigError(f\"Invalid trainer type {val} was found\")\n            else:\n                d_copy[key] = check_and_structure(key, val, t)\n        return t(**d_copy)\n\n    class DefaultTrainerDict(collections.defaultdict):\n        def __init__(self, *args):\n            # Depending on how this is called, args may have the defaultdict","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents/mlagents/trainers/settings.py#L693-L729","documentation":"After determining trainer_type, the hook looks up matching hyperparameter settings in all_trainer_settings; if hyperparameters were specified but the trainer_type has no corresponding settings class registered, a KeyError is converted to TrainerConfigError.","triggerScenarios":"A config specifies hyperparameters plus a trainer_type whose settings are absent from all_trainer_settings — typically an invalid/unknown trainer_type string that slipped past earlier checks, or a custom/partial trainer registry.","commonSituations":"Typos like 'ppo ' (trailing space) or 'PPO' casing in trainer_type; version changes renaming trainer types; edited ML-Agents builds with restricted trainer registries.","solutions":["Set trainer_type to one of ppo, sac, or poca (exact lowercase spelling).","Check for whitespace/casing typos in trainer_type.","Confirm the ML-Agents version supports the trainer type in your config."],"exampleFix":"// before\ntrainer_type: ppo_old\n// after\ntrainer_type: ppo","handlingStrategy":"validation","validationCode":"VALID = {'ppo', 'sac', 'poca'}\nif cfg.get('trainer_type') not in VALID:\n    raise ValueError(f'trainer_type must be one of {VALID}')","typeGuard":"def is_known_trainer_type(v):\n    return v in ('ppo', 'sac', 'poca')","tryCatchPattern":"from mlagents.trainers.exception import TrainerConfigError\ntry:\n    load_config(path)\nexcept TrainerConfigError as e:\n    if 'were not found' in str(e):\n        logger.error('Check trainer_type spelling: %s', e)","preventionTips":["Use exact lowercase trainer types: ppo, sac, poca","Strip whitespace from trainer_type values","Pin ML-Agents version and verify config against its docs"],"tags":["config","ml-agents"],"backgroundTag":"invalid-enum-value","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}