{"record":{"id":"1908233acaee9ccc","repo":"dotnet/machinelearning","slug":"value-cannot-be-null-parameter-other","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'other')","messagePattern":"Value cannot be null\\. \\(Parameter 'other'\\)","errorType":"validation","errorClass":"System.ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/DataFrame.Join.cs","lineNumber":334,"sourceCode":"                    }\n                }\n                else\n                {\n                    foreach (long row in supplementaryJoinColumnsNullIndices)\n                    {\n                        retainedRowIndices.Append(i);\n                        supplementaryRowIndices.Append(row);\n                    }\n                }\n            }\n\n            return intersection;\n        }\n\n        public DataFrame Merge(DataFrame other, string[] leftJoinColumns, string[] rightJoinColumns, string leftSuffix = \"_left\", string rightSuffix = \"_right\", JoinAlgorithm joinAlgorithm = JoinAlgorithm.Left)\n        {\n            if (other == null)\n                throw new ArgumentNullException(nameof(other));\n\n            // In Outer join the joined dataframe retains each row — even if no other matching row exists in supplementary dataframe.\n            // Outer joins subdivide further into left outer joins (left dataframe is retained), right outer joins (rightdataframe is retained), in full outer both are retained\n\n            PrimitiveDataFrameColumn<long> retainedRowIndices;\n            PrimitiveDataFrameColumn<long> supplementaryRowIndices;\n            DataFrame supplementaryDataFrame;\n            DataFrame retainedDataFrame;\n            bool isLeftDataFrameRetained;\n\n            if (joinAlgorithm == JoinAlgorithm.Left || joinAlgorithm == JoinAlgorithm.Right)\n            {\n                isLeftDataFrameRetained = (joinAlgorithm == JoinAlgorithm.Left);\n\n                supplementaryDataFrame = isLeftDataFrameRetained ? other : this;\n                var supplementaryJoinColumns = isLeftDataFrameRetained ? rightJoinColumns : leftJoinColumns;\n\n                retainedDataFrame = isLeftDataFrameRetained ? this : other;","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/DataFrame.Join.cs#L316-L352","documentation":"DataFrame.Merge throws ArgumentNullException immediately when the `other` DataFrame is null. The library requires a concrete right-hand DataFrame to compute join row-index mappings, so it validates the argument before any join algorithm runs. The message names the offending parameter ('other').","triggerScenarios":"Calling df.Merge(null, leftJoinColumns, rightJoinColumns) — directly or via a variable that was never assigned, or the result of a lookup/API call that returned null — with any JoinAlgorithm (Left, Right, Outer).","commonSituations":"Loading the second dataset from a file or database that returned null on failure; a conditional pipeline where an optional enrichment DataFrame is absent; refactoring that renamed a field but left an old null-returning getter in place.","solutions":["Ensure the `other` DataFrame is constructed/loaded before calling Merge (e.g. DataFrame.LoadCsv succeeded and was assigned).","Guard the call: if (other == null) { load or substitute an empty DataFrame; } before merging.","If the right side may legitimately be empty, pass new DataFrame() with the matching join columns instead of null.","Catch ArgumentNullException to surface a clear message naming the missing dataset source."],"exampleFix":"// before\nDataFrame merged = orders.Merge(null, new[]{\"Id\"}, new[]{\"OrderId\"});\n// after\nif (right == null)\n    throw new InvalidOperationException(\"Right dataset was not loaded\");\nDataFrame merged = orders.Merge(right, new[]{\"Id\"}, new[]{\"OrderId\"});","handlingStrategy":"validation","validationCode":"if (other == null)\n    throw new InvalidOperationException(\"Right DataFrame for Merge was not loaded\");\n// safe:\nvar merged = left.Merge(other, leftCols, rightCols);","typeGuard":"bool CanMerge(DataFrame other) => other is not null;","tryCatchPattern":"try { merged = left.Merge(other, lc, rc); }\ncatch (ArgumentNullException ex) { logger.LogError(ex, \"Merge input null\"); merged = left; }","preventionTips":["Never let dataset loaders return null — throw on load failure","Validate all merge inputs at the pipeline boundary","Use nullable reference types (DataFrame?) to surface unassigned variables at compile time"],"tags":["argument-null","join","merge","dataframe"],"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"}