dotnet/machinelearning · error · ArgumentException

Specified column {columnName} is not found in the dataset.

Error message

Specified column {columnName} is not found in the dataset.

What it means

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.

Source

Thrown at src/Microsoft.ML.AutoML/ColumnInference/ColumnInferenceValidationUtil.cs:22

using System;

namespace Microsoft.ML.AutoML
{
    internal static class ColumnInferenceValidationUtil
    {
        /// <summary>
        /// Validate all columns specified in column info exist in inferred data view.
        /// </summary>
        public static void ValidateSpecifiedColumnsExist(ColumnInformation columnInfo,
            IDataView dataView)
        {
            var columnNames = ColumnInformationUtil.GetColumnNames(columnInfo);
            foreach (var columnName in columnNames)
            {
                if (dataView.Schema.GetColumnOrNull(columnName) == null)
                {
                    throw new ArgumentException($"Specified column {columnName} " +
                        $"is not found in the dataset.");
                }
            }
        }
    }
}

View on GitHub (pinned to 7b76e69cf9)

Solutions

  1. Print dataView.Schema and confirm the exact column name exists; correct the spelling/case in ColumnInformation
  2. Trim whitespace from header names and your configuration
  3. If the file changed, regenerate the ColumnInformation from the current schema
  4. Match names exactly — ML.NET schema lookups are case-sensitive

Example fix

// before
var columnInfo = new ColumnInformation { LabelColumnName = "Target " };
// after
var actual = dataView.Schema.First(c => c.IsHidden == false).Name;
var columnInfo = new ColumnInformation { LabelColumnName = dataView.Schema.GetColumnOrNull("Target")?.Name ?? "Target" };
Defensive patterns

Strategy: validation

Validate before calling

foreach (var name in ColumnInformationUtil.GetColumnNames(columnInfo))
    if (dataView.Schema.GetColumnOrNull(name) == null)
        throw new ArgumentException($"Column '{name}' missing");

Try / catch

try { /* setup experiment with columnInfo */ }
catch (ArgumentException ex) when (ex.Message.Contains("is not found in the dataset"))
{ /* fix column name */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11). Data as JSON: /api/errors/2ae20b30069a6338. Report an issue: GitHub.