{"record":{"id":"e40c02ee57c2bddb","repo":"dotnet/machinelearning","slug":"provided-path-cannot-be-null","errorCode":null,"errorMessage":"Provided path cannot be null","messagePattern":"Provided path cannot be null","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"critical","filePath":"src/Microsoft.ML.AutoML/Utils/UserInputValidationUtil.cs","lineNumber":168,"sourceCode":"            if (columns?.Contains(null) == true)\n            {\n                throw new ArgumentException($\"Null column string was specified as {columnPurpose} in column information\");\n            }\n        }\n\n        private static void ValidateLabelColumn(string labelColumn)\n        {\n            if (labelColumn == null)\n            {\n                throw new ArgumentException(\"Provided label column cannot be null\");\n            }\n        }\n\n        private static void ValidatePath(string path)\n        {\n            if (path == null)\n            {\n                throw new ArgumentNullException(nameof(path), \"Provided path cannot be null\");\n            }\n\n            var fileInfo = new FileInfo(path);\n\n            if (!fileInfo.Exists)\n            {\n                throw new ArgumentException($\"File '{path}' does not exist\", nameof(path));\n            }\n\n            if (fileInfo.Length == 0)\n            {\n                throw new ArgumentException($\"File at path '{path}' cannot be empty\", nameof(path));\n            }\n        }\n\n        private static void ValidateValidationData(IDataView trainData, IDataView validationData)\n        {\n            if (validationData == null)","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.ML.AutoML/Utils/UserInputValidationUtil.cs#L150-L186","documentation":"Thrown by UserInputValidationUtil.ValidatePath when the file path supplied to the infer-columns API (ValidateInferColumnsArgs) is null. The path identifies the training data file to inspect, so it is mandatory and reported via ArgumentNullException naming the path parameter.","triggerScenarios":"Calling InferColumns overloads with path = null, usually because a config value or command-line argument was not supplied.","commonSituations":"Missing appsetting/connection-string entry for the data file path; CLI args array missing an element; environment-specific path variable empty in CI.","solutions":["Provide a valid file path string to the InferColumns call","Resolve the path from configuration with a null/empty check before calling","Fix the config/CLI plumbing so the path value is populated"],"exampleFix":"// before\nstring dataPath = configuration[\"DataPath\"]; // null\nvar columns = mlContext.Auto().InferColumns<ModelInput>(dataPath, labelColumnName: \"Label\");\n\n// after\nstring dataPath = configuration[\"DataPath\"] ?? throw new InvalidOperationException(\"DataPath config missing\");\nvar columns = mlContext.Auto().InferColumns<ModelInput>(dataPath, labelColumnName: \"Label\");","handlingStrategy":"type-guard","validationCode":"if (string.IsNullOrWhiteSpace(path)) throw new InvalidOperationException(\"Data file path is required\");","typeGuard":"static bool HasPath(string p) => !string.IsNullOrWhiteSpace(p);","tryCatchPattern":"try { var cols = mlContext.Auto().InferColumns(path, labelColumnName); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"path\") { /* resolve path from fallback config and retry */ }","preventionTips":["Fail fast at startup if the configured data path is null/empty","Wrap path resolution in one helper that guarantees non-null output","Validate required CLI/config arguments before running experiments"],"tags":["dotnet","mlnet","automl","null-argument","path"],"backgroundTag":"null-argument","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"}