{"record":{"id":"4e9b261c5f9fad7f","repo":"dotnet/machinelearning","slug":"fail-to-find-available-configs-for-given-trainers","errorCode":null,"errorMessage":"Fail to find available configs for given trainers: {string.Join(\",\", trainerEstimators)}","messagePattern":"Fail to find available configs for given trainers: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.ML.AutoML/Tuner/AutoZeroTuner.cs","lineNumber":57,"sourceCode":"            var trainerEstimators = _sweepablePipeline.Estimators.Where(e => e.Value.EstimatorType.IsTrainer()).Select(e => e.Value.EstimatorType.ToString()).ToList();\n            _configs = evaluateMetricManager switch\n            {\n                BinaryMetricManager => _configs.Where(c => c.Task == \"binary-classification\" && trainerEstimators.Contains(c.Trainer)).ToList(),\n                MultiClassMetricManager => _configs.Where(c => c.Task == \"multi-classification\" && trainerEstimators.Contains(c.Trainer)).ToList(),\n                RegressionMetricManager => _configs.Where(c => c.Task == \"regression\" && trainerEstimators.Contains(c.Trainer)).ToList(),\n                _ => throw new Exception(),\n            };\n            _metricName = evaluateMetricManager switch\n            {\n                BinaryMetricManager bm => bm.Metric.ToString(),\n                MultiClassMetricManager mm => mm.Metric.ToString(),\n                RegressionMetricManager rm => rm.Metric.ToString(),\n                _ => throw new Exception(),\n            };\n\n            if (_configs.Count == 0)\n            {\n                throw new ArgumentException($\"Fail to find available configs for given trainers: {string.Join(\",\", trainerEstimators)}\");\n            }\n\n            _configsEnumerator = _configs.GetEnumerator();\n            aggregateTrainingStopManager.AddTrainingStopManager(new MaxModelStopManager(_configs.Count, null));\n        }\n\n        private List<Config> LoadConfigsFromJson()\n        {\n            var assembly = Assembly.GetExecutingAssembly();\n            var resourceName = \"Microsoft.ML.AutoML.Tuner.Portfolios.json\";\n\n            using (Stream stream = assembly.GetManifestResourceStream(resourceName))\n            using (StreamReader reader = new StreamReader(stream))\n            {\n                var json = reader.ReadToEnd();\n                var res = JsonSerializer.Deserialize<List<Config>>(json);\n\n                return res;","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.ML.AutoML/Tuner/AutoZeroTuner.cs#L39-L75","documentation":"The AutoZeroTuner constructor filters its config set by the trainers relevant to the metric/task; if no built-in configs match the supplied trainer estimators, _configs is empty and it throws ArgumentException, since tuning cannot proceed with zero candidate configurations.","triggerScenarios":"Constructing AutoZeroTuner with trainer estimator names not present in AutoZero's built-in config library (typo'd trainer name, custom trainer, or unsupported task/metric switch).","commonSituations":"Passing custom or newly added trainers to AutoZero tuning; misspelled trainer identifiers; using AutoZero with a task whose metric manager returns an unmatched metric.","solutions":["Use trainer names supported by AutoZero's config set (built-in trainers for binary/regression tasks).","Verify trainer estimator identifiers for typos and exact naming.","Fall back to a standard tuner (e.g. grid/random) if using custom trainers."],"exampleFix":"// before\nvar tuner = new AutoZeroTuner(context, new[] { \"myCustomTrainer\" });\n// after\nvar tuner = new AutoZeroTuner(context, new[] { \"FastForest\", \"LightGbm\" });","handlingStrategy":"validation","validationCode":"var supported = new[] { \"FastForest\", \"FastTree\", \"Lgbm\", ... };\nif (trainerEstimators.Any(t => !supported.Contains(t)))\n    throw new ArgumentException(\"AutoZero only supports built-in trainer configs\");","typeGuard":null,"tryCatchPattern":"try { var tuner = new AutoZeroTuner(context, trainers); }\ncatch (ArgumentException ex) { logger.LogError(ex, \"No AutoZero configs for trainers\"); tuner = new RandomTuner(); }","preventionTips":["Only use AutoZero-supported trainer names","Validate trainer identifiers against the built-in config library","Prefer standard tuners for custom trainers"],"tags":["csharp","tuner","configuration"],"backgroundTag":"invalid-argument-value","analyzedSha":"7b76e69cf964daeca3f1377af6bc5543284d56c6","analyzedAt":"2026-09-11T12:35:38.930Z","contentChangedAt":"2026-09-11T12:35:38.930Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}