dotnet/machinelearning · error · ArgumentException
The data type '{dataKind}' is not handled currently.
Error message
The data type '{dataKind}' is not handled currently. What it means
Utils.GetSymbolOfDataKind resolves a DataKind to the corresponding CSharpCodeProvider code-dom type symbol (Symbols.*). When the DataKind isn't one of the handled cases the default branch throws this ArgumentException. It's raised while GenerateClassLabels builds class/enum declarations for generated C# code, meaning the column's data type cannot be represented by the generator.
Source
Thrown at src/Microsoft.ML.CodeGenerator/Utils.cs:362
{
case DataKind.String:
return Symbols.StringSymbol;
case DataKind.Boolean:
return Symbols.BoolSymbol;
case DataKind.Single:
return Symbols.FloatSymbol;
case DataKind.Double:
return Symbols.DoubleSymbol;
case DataKind.Int32:
return Symbols.IntSymbol;
case DataKind.UInt32:
return Symbols.UIntSymbol;
case DataKind.Int64:
return Symbols.LongSymbol;
case DataKind.UInt64:
return Symbols.UlongSymbol;
default:
throw new ArgumentException($"The data type '{dataKind}' is not handled currently.");
}
}
}
}
View on GitHub (pinned to 7b76e69cf9)
Solutions
- Pre-convert the offending column to a supported numeric kind (mlContext.Transforms.Conversion.ConvertType) before code generation.
- Upgrade Microsoft.ML.CodeGenerator to a build that maps your DataKind to a symbol.
- Filter out or rename unsupported columns before running AutoML + codegen.
- Extend GetSymbolOfDataKind with a case for the missing DataKind if you control the source.
Example fix
// before
var pipeline = mlContext.Transforms.Concatenate("Features", "IsWeekend", "Amount");
// after: convert bool column to a handled kind first
var pipeline = mlContext.Transforms.Conversion.ConvertType("IsWeekendNum", "IsWeekend", outputKind: DataKind.Single)
.Append(mlContext.Transforms.Concatenate("Features", "IsWeekendNum", "Amount")); Defensive patterns
Strategy: validation
Validate before calling
var supported = new HashSet<DataKind> { DataKind.Single, DataKind.Double, DataKind.Int32,
DataKind.UInt32, DataKind.Int64, DataKind.UInt64, DataKind.Int16, DataKind.UInt16, DataKind.Byte, DataKind.SByte };
foreach (var col in schema)
if (!supported.Contains(((DataViewType)col.Type).GetRawKind().GetValueOrDefault()))
throw new InvalidOperationException($"Column {col.Name} kind unsupported for codegen"); Type guard
static bool IsSymbolSupported(DataKind kind) => kind is DataKind.Single or DataKind.Double
or DataKind.Int32 or DataKind.UInt32 or DataKind.Int64 or DataKind.UInt64
or DataKind.Int16 or DataKind.UInt16 or DataKind.Byte or DataKind.SByte; Try / catch
try
{
var symbol = Utils.GetSymbolOfDataKind(kind);
}
catch (ArgumentException ex) when (ex.Message.Contains("is not handled currently"))
{
symbol = null; // skip emitting this column, log the kind
} Prevention
- Pre-convert bool/datetime/string feature columns with ConvertType before codegen.
- Audit column kinds in your pipeline before conversion to C#.
- Keep CodeGenerator aligned with the DataKind set in your Microsoft.ML packages.
- Handle unrepresentable columns by excluding them from Features explicitly.
When it happens
Trigger: GenerateClassLabels processes a pipeline node whose column/label DataKind is outside the handled set (Boolean, DateTime, TimeSpan, String, etc.), so GetSymbolOfDataKind hits its default throw while emitting the C# class.
Common situations: Datasets with bool/datetime/string feature columns being converted to C# by mlnet codegen; version drift where newer DataKind values exist; columns loaded via custom IDataView loaders with unusual types.
Related errors
- The data type '{labelType}' is not handled currently.
- The trainer '{trainer}' is not handled currently.
- The trainer '{node.Name}' is not handled currently.
- Bad type in ColumnTypeExtensions.NumberTypeFromType: {type}
- Bad data kind in ColumnTypeExtensions.NumberTypeFromKind: {k
AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11).
Data as JSON: /api/errors/a2b4a550827042b2.
Report an issue: GitHub.