{"record":{"id":"692ab6d4f592d6f1","repo":"dotnet/machinelearning","slug":"strings-multiplemismatchedvaluetype-formatted-wit","errorCode":null,"errorMessage":"Strings.MultipleMismatchedValueType (formatted with typeof(long), typeof(int), typeof(bool))","messagePattern":"Strings\\.MultipleMismatchedValueType \\(formatted with typeof\\(long\\), typeof\\(int\\), typeof\\(bool\\)\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/DataFrameColumns/ArrowStringDataFrameColumn.cs","lineNumber":400,"sourceCode":"\n            for (long i = 0; i < Length; i++)\n                ret.Append(IsValid(i) ? GetBytes(i) : default(ReadOnlySpan<byte>));\n\n            for (long i = 0; i < numberOfNullsToAppend; i++)\n                ret.Append(default);\n\n            return ret;\n        }\n\n        /// <inheritdoc/>\n        protected override DataFrameColumn CloneImplementation(DataFrameColumn mapIndices, bool invertMapIndices = false, long numberOfNullsToAppend = 0)\n        {\n            ArrowStringDataFrameColumn clone;\n            if (!(mapIndices is null))\n            {\n                Type dataType = mapIndices.DataType;\n                if (dataType != typeof(long) && dataType != typeof(int) && dataType != typeof(bool))\n                    throw new ArgumentException(String.Format(Strings.MultipleMismatchedValueType, typeof(long), typeof(int), typeof(bool)), nameof(mapIndices));\n                if (mapIndices.DataType == typeof(long))\n                    clone = CloneImplementation(mapIndices as PrimitiveDataFrameColumn<long>, invertMapIndices);\n                else if (dataType == typeof(int))\n                    clone = CloneImplementation(mapIndices as PrimitiveDataFrameColumn<int>, invertMapIndices);\n                else\n                    clone = CloneImplementation(mapIndices as PrimitiveDataFrameColumn<bool>);\n\n                for (long i = 0; i < numberOfNullsToAppend; i++)\n                    clone.Append(default);\n            }\n            else\n            {\n                clone = Clone(numberOfNullsToAppend);\n            }\n\n            return clone;\n        }\n","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/DataFrameColumns/ArrowStringDataFrameColumn.cs#L382-L418","documentation":"ArrowStringDataFrameColumn.Clone validates that the mapIndices column's data type is one of long, int, or bool, since only PrimitiveDataFrameColumn<long>, <int>, or <bool> index maps are supported. Passing any other element type (e.g. string, short, double) makes it impossible to select/reorder rows, so an ArgumentException naming the three accepted types is thrown.","triggerScenarios":"Calling column.Clone(mapIndices) where mapIndices is a PrimitiveDataFrameColumn<T> with T other than long/int/bool, e.g. Clone(otherStringColumn) or a column of shorts/doubles/uints.","commonSituations":"Passing a filtered column of values instead of indices; using a column whose DataType changed after arithmetic (e.g. double-valued index math); copying code that used another column type as an index map.","solutions":["Pass a PrimitiveDataFrameColumn<long> (or int/bool) as the index map instead of the offending type.","Convert the index column first, e.g. new PrimitiveDataFrameColumn<long>(\"indices\", indices.Select(i => (long)i)).","Use the parameterless Clone() and then Filter(boolColumn) if you meant boolean row selection.","Inspect mapIndices.DataType and branch before calling Clone."],"exampleFix":"// before\ncol.Clone(doubleIndexColumn);\n// after\ncol.Clone(new PrimitiveDataFrameColumn<long>(\"idx\", doubleIndexColumn.Select(d => (long)d)));","handlingStrategy":"validation","validationCode":"if (mapIndices != null && mapIndices.DataType != typeof(long) && mapIndices.DataType != typeof(int) && mapIndices.DataType != typeof(bool))\n    throw new ArgumentException($\"mapIndices must be PrimitiveDataFrameColumn<long>, <int>, or <bool>; got {mapIndices.DataType.Name}\", nameof(mapIndices));","typeGuard":"bool IsValidIndexMap<T>(DataFrameColumn c) => c is PrimitiveDataFrameColumn<long> || c is PrimitiveDataFrameColumn<int> || c is PrimitiveDataFrameColumn<bool>;","tryCatchPattern":null,"preventionTips":["Always use long (or int/bool) index columns for Clone/Filter maps","Check mapIndices.DataType before calling Clone","Use Filter(boolColumn) for boolean row selection instead of hand-built maps"],"tags":["dotnet","dataframe","argument-validation"],"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"}