dotnet/machinelearning · error · NotSupportedException
String.Format(Microsoft.Data.Strings.VectorSubTypeNotSupport
Error message
String.Format(Microsoft.Data.Strings.VectorSubTypeNotSupported, itemType.ToString())
What it means
GetVectorDataFrame allocates a VBufferDataFrameColumn<T> only for a fixed set of vector item types; for any other itemType it throws NotSupportedException(Strings.VectorSubTypeNotSupported, itemType). Reached from ToDataFrame when a vector column's element type is unsupported.
Source
Thrown at src/Microsoft.Data.Analysis/IDataView.Extension.cs:212
}
else if (itemType.RawType == typeof(ushort))
{
return new VBufferDataFrameColumn<ushort>(name);
}
else if (itemType.RawType == typeof(char))
{
return new VBufferDataFrameColumn<char>(name);
}
else if (itemType.RawType == typeof(decimal))
{
return new VBufferDataFrameColumn<decimal>(name);
}
else if (itemType.RawType == typeof(ReadOnlyMemory<char>))
{
return new VBufferDataFrameColumn<ReadOnlyMemory<char>>(name);
}
throw new NotSupportedException(String.Format(Microsoft.Data.Strings.VectorSubTypeNotSupported, itemType.ToString()));
}
}
}
View on GitHub (pinned to 7b76e69cf9)
Solutions
- Change the pipeline so the vector item type is a supported primitive (e.g. float, double, ReadOnlyMemory<char>).
- Project the unsupported vector into a supported representation in the source IDataView.
- Remove or split the unsupported vector column before calling ToDataFrame.
- Copy the column manually into a VBufferDataFrameColumn<T> of a supported T.
Example fix
// before var df = dataView.ToDataFrame(); // vector of unsupported item type // after // expose the column as a vector of float in the source: Output = new VectorDataViewType(NumberDataViewType.Single, size);
Defensive patterns
Strategy: validation
Validate before calling
bool ok = dataView.Schema.Where(s => s.Type is VectorDataViewType v)
.All(s => IsSupportedItemType(((VectorDataViewType)s.Type).ItemType)); Type guard
static bool IsSupportedItemType(DataViewType t) =>
t == NumberDataViewType.Single || t == NumberDataViewType.Double ||
t == TextDataViewType.Instance || t == NumberDataViewType.Int32; Try / catch
try { var df = dataView.ToDataFrame(); }
catch (NotSupportedException ex) when (ex.Message.Contains("vector"))
{ /* unsupported vector item type: reproject the column */ } Prevention
- Restrict vector columns to supported item types at the source.
- Assert vector item types in pipeline unit tests.
- Convert exotic vectors to float/double upstream.
- Document supported item types for custom IDataView implementations.
When it happens
Trigger: Converting an IDataView whose schema has a VectorDataViewType with an item type outside the supported list (e.g. vectors of TimeSpan or unknown structs).
Common situations: Custom IDataView implementations exposing vector columns of unusual element types; transforms producing vectors of non-standard primitives; exotic data sources fed to ToDataFrame.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- String.Format(Microsoft.Data.Strings.NotSupportedColumnType,
- Validation data has 0 rows
- Training data and validation data schemas do not match. Trai
- Training data and validation data schemas do not match. Colu
- Training data and validation data schemas do not match. Colu
AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11).
Data as JSON: /api/errors/653c933e11ec2cf9.
Report an issue: GitHub.