{"record":{"id":"2ae20b30069a6338","repo":"dotnet/machinelearning","slug":"specified-column-columnname-is-not-found-in-the","errorCode":null,"errorMessage":"Specified column {columnName} is not found in the dataset.","messagePattern":"Specified column (.+?) is not found in the dataset\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceValidationUtil.cs","lineNumber":22,"sourceCode":"\nusing System;\n\nnamespace Microsoft.ML.AutoML\n{\n    internal static class ColumnInferenceValidationUtil\n    {\n        /// <summary>\n        /// Validate all columns specified in column info exist in inferred data view.\n        /// </summary>\n        public static void ValidateSpecifiedColumnsExist(ColumnInformation columnInfo,\n            IDataView dataView)\n        {\n            var columnNames = ColumnInformationUtil.GetColumnNames(columnInfo);\n            foreach (var columnName in columnNames)\n            {\n                if (dataView.Schema.GetColumnOrNull(columnName) == null)\n                {\n                    throw new ArgumentException($\"Specified column {columnName} \" +\n                        $\"is not found in the dataset.\");\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":4,"sourceCodeEnd":29,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceValidationUtil.cs#L4-L29","documentation":"Before column inference, AutoML validates that every column explicitly named in the ColumnInformation (label, features, grouping, etc.) actually exists in the loaded IDataView schema. ValidateSpecifiedColumnsExist throws ArgumentException naming the missing column when a schema lookup returns null. It prevents downstream inference from silently ignoring user-specified roles.","triggerScenarios":"Passing a ColumnInformation with a label/samplingKey/grouping/feature/userDefined column name that doesn't exist in the dataset's schema; calling column inference or experiment setup with a misspelled column name; column renamed between data export and AutoML setup.","commonSituations":"Typos or case mismatches in column names (schema lookups are case-sensitive); CSV header changed upstream; using index-based expectations against a file whose header differs; whitespace in header names.","solutions":["Print dataView.Schema and confirm the exact column name exists; correct the spelling/case in ColumnInformation","Trim whitespace from header names and your configuration","If the file changed, regenerate the ColumnInformation from the current schema","Match names exactly — ML.NET schema lookups are case-sensitive"],"exampleFix":"// before\nvar columnInfo = new ColumnInformation { LabelColumnName = \"Target \" };\n// after\nvar actual = dataView.Schema.First(c => c.IsHidden == false).Name;\nvar columnInfo = new ColumnInformation { LabelColumnName = dataView.Schema.GetColumnOrNull(\"Target\")?.Name ?? \"Target\" };","handlingStrategy":"validation","validationCode":"foreach (var name in ColumnInformationUtil.GetColumnNames(columnInfo))\n    if (dataView.Schema.GetColumnOrNull(name) == null)\n        throw new ArgumentException($\"Column '{name}' missing\");","typeGuard":null,"tryCatchPattern":"try { /* setup experiment with columnInfo */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"is not found in the dataset\"))\n{ /* fix column name */ }","preventionTips":["Dump dataView.Schema and copy names exactly","Watch for case sensitivity and stray whitespace in headers","Regenerate column config when the dataset schema changes"],"tags":["dotnet","ml-automl","column-name","argument"],"backgroundTag":"resource-not-found","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"}