dotnet/machinelearning · error · ArgumentException

Fail to find available configs for given trainers: {string.J

Error message

Fail to find available configs for given trainers: {string.Join(",", trainerEstimators)}

What it means

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.

Source

Thrown at src/Microsoft.ML.AutoML/Tuner/AutoZeroTuner.cs:57

            var trainerEstimators = _sweepablePipeline.Estimators.Where(e => e.Value.EstimatorType.IsTrainer()).Select(e => e.Value.EstimatorType.ToString()).ToList();
            _configs = evaluateMetricManager switch
            {
                BinaryMetricManager => _configs.Where(c => c.Task == "binary-classification" && trainerEstimators.Contains(c.Trainer)).ToList(),
                MultiClassMetricManager => _configs.Where(c => c.Task == "multi-classification" && trainerEstimators.Contains(c.Trainer)).ToList(),
                RegressionMetricManager => _configs.Where(c => c.Task == "regression" && trainerEstimators.Contains(c.Trainer)).ToList(),
                _ => throw new Exception(),
            };
            _metricName = evaluateMetricManager switch
            {
                BinaryMetricManager bm => bm.Metric.ToString(),
                MultiClassMetricManager mm => mm.Metric.ToString(),
                RegressionMetricManager rm => rm.Metric.ToString(),
                _ => throw new Exception(),
            };

            if (_configs.Count == 0)
            {
                throw new ArgumentException($"Fail to find available configs for given trainers: {string.Join(",", trainerEstimators)}");
            }

            _configsEnumerator = _configs.GetEnumerator();
            aggregateTrainingStopManager.AddTrainingStopManager(new MaxModelStopManager(_configs.Count, null));
        }

        private List<Config> LoadConfigsFromJson()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var resourceName = "Microsoft.ML.AutoML.Tuner.Portfolios.json";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            using (StreamReader reader = new StreamReader(stream))
            {
                var json = reader.ReadToEnd();
                var res = JsonSerializer.Deserialize<List<Config>>(json);

                return res;

View on GitHub (pinned to 7b76e69cf9)

Solutions

  1. Use trainer names supported by AutoZero's config set (built-in trainers for binary/regression tasks).
  2. Verify trainer estimator identifiers for typos and exact naming.
  3. Fall back to a standard tuner (e.g. grid/random) if using custom trainers.

Example fix

// before
var tuner = new AutoZeroTuner(context, new[] { "myCustomTrainer" });
// after
var tuner = new AutoZeroTuner(context, new[] { "FastForest", "LightGbm" });
Defensive patterns

Strategy: validation

Validate before calling

var supported = new[] { "FastForest", "FastTree", "Lgbm", ... };
if (trainerEstimators.Any(t => !supported.Contains(t)))
    throw new ArgumentException("AutoZero only supports built-in trainer configs");

Try / catch

try { var tuner = new AutoZeroTuner(context, trainers); }
catch (ArgumentException ex) { logger.LogError(ex, "No AutoZero configs for trainers"); tuner = new RandomTuner(); }

Prevention

When it happens

Trigger: 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).

Common situations: Passing custom or newly added trainers to AutoZero tuning; misspelled trainer identifiers; using AutoZero with a task whose metric manager returns an unmatched metric.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11). Data as JSON: /api/errors/4e9b261c5f9fad7f. Report an issue: GitHub.