dotnet/machinelearning · error · ArgumentException
The runner metric manager is of type {_metricManager.GetType
Error message
The runner metric manager is of type {_metricManager.GetType()} which expected to be of type {typeof(ITrainValidateDatasetManager)} or {typeof(ICrossValidateDatasetManager)} What it means
The AutoML experiment runner's _metricManager must be an ITrainValidateDatasetManager or ICrossValidateDatasetManager for BinaryClassification trials; if it is any other type, Run throws ArgumentException because the metric/dataset management contract is unfulfillable. This is an internal invariant failure of the AutoML framework.
Source
Thrown at src/Microsoft.ML.AutoML/API/BinaryClassificationExperiment.cs:445
var loss = metricManager.IsMaximize ? -metric : metric;
stopWatch.Stop();
return new TrialResult<BinaryClassificationMetrics>()
{
Loss = loss,
Metric = metric,
Model = model,
TrialSettings = settings,
DurationInMilliseconds = stopWatch.ElapsedMilliseconds,
Metrics = metrics,
Pipeline = refitPipeline,
};
}
}
throw new ArgumentException($"The runner metric manager is of type {_metricManager.GetType()} which expected to be of type {typeof(ITrainValidateDatasetManager)} or {typeof(ICrossValidateDatasetManager)}");
}
public Task<TrialResult> RunAsync(TrialSettings settings, CancellationToken ct)
{
try
{
using (var ctRegistration = ct.Register(() =>
{
_context?.CancelExecution();
}))
{
return Task.FromResult(Run(settings));
}
}
catch (Exception ex) when (ct.IsCancellationRequested)
{
throw new OperationCanceledException(ex.Message, ex.InnerException);
}View on GitHub (pinned to 7b76e69cf9)
Solutions
- Use a supported Microsoft.ML.AutoML version and avoid mixing AutoML assemblies
- Ensure custom experiment/runners set _metricManager to ITrainValidateDatasetManager or ICrossValidateDatasetManager
- Report/pin consistent package versions across Microsoft.ML.AutoML and dependents
Example fix
// before: custom runner with wrong manager _metricManager = new MyCustomDatasetManager(); // after _metricManager = new TrainValidateDatasetManager(...); // or CrossValidationDatasetManager
Defensive patterns
Strategy: try-catch
Validate before calling
// pin and verify AutoML package versions at build time dotnet list package --include-transitive | grep Microsoft.ML.AutoML
Type guard
null
Try / catch
try { var r = experiment.Run(trainData, null); } catch (ArgumentException ex) when (ex.Message.Contains("runner metric manager")) { // fix component wiring / package versions, then rerun
throw; } Prevention
- Don't mix Microsoft.ML.AutoML versions across projects
- When extending runners, set _metricManager to a supported manager type
- Test experiment startup with a tiny dataset before long runs
When it happens
Trigger: TrialSettings/Tuner configuration producing a metric manager of an unexpected type — e.g. custom experiment extensions or mismatched AutoML component versions where a different IDatasetManager implementation is injected.
Common situations: Mixing Microsoft.ML.AutoML package versions; subclassing/extending experiments and wiring a custom runner whose _metricManager isn't one of the two supported managers.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- The runner metric manager is of type {_metricManager.GetType
- The runner metric manager is of type {_metricManager.GetType
- result must be of type {typeof(TrialResult<TMetrics>)}
- {DefaultColumnNames.Features} column must be of data type {N
- Cannot cast elements of column '{0}' type of {1} to type {2}
AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11).
Data as JSON: /api/errors/810642a2acfb8524.
Report an issue: GitHub.