{"record":{"id":"925fd1c2554fa7cc","repo":"apache/flink","slug":"the-input-may-not-contain-null-elements","errorCode":null,"errorMessage":"The input may not contain null elements.","messagePattern":"The input may not contain null elements\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/operators/Operator.java","lineNumber":261,"sourceCode":"            return input2[0];\n        }\n\n        TypeInformation<T> type = null;\n        if (input1 != null) {\n            type = input1.getOperatorInfo().getOutputType();\n        } else if (input2.length > 0 && input2[0] != null) {\n            type = input2[0].getOperatorInfo().getOutputType();\n        } else {\n            throw new IllegalArgumentException(\"Could not determine type information from inputs.\");\n        }\n\n        // Otherwise construct union cascade\n        Union<T> lastUnion =\n                new Union<T>(new BinaryOperatorInformation<T, T, T>(type, type, type), \"<unknown>\");\n\n        int i;\n        if (input2[0] == null) {\n            throw new IllegalArgumentException(\"The input may not contain null elements.\");\n        }\n        lastUnion.setFirstInput(input2[0]);\n\n        if (input1 != null) {\n            lastUnion.setSecondInput(input1);\n            i = 1;\n        } else {\n            if (input2[1] == null) {\n                throw new IllegalArgumentException(\"The input may not contain null elements.\");\n            }\n            lastUnion.setSecondInput(input2[1]);\n            i = 2;\n        }\n        for (; i < input2.length; i++) {\n            Union<T> tmpUnion =\n                    new Union<T>(\n                            new BinaryOperatorInformation<T, T, T>(type, type, type), \"<unknown>\");\n            tmpUnion.setSecondInput(lastUnion);","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/operators/Operator.java#L243-L279","documentation":"Thrown by Operator.createUnionCascade when input2[0] is null at the point of setting the first input of the union cascade. Even though type may have been inferred earlier, the method explicitly rejects null operators before wiring them into the Union DAG.","triggerScenarios":"createUnionCascade(input1, null, otherOp) where the first element of the varargs array is null. Passing a list whose first entry is a null operator.","commonSituations":"Varargs arrays built from nullable sources where the first slot is null. Refactors that reorder operators leaving null at index 0.","solutions":["Remove null elements from the operators array before calling createUnionCascade.","Ensure the first vararg element is always a concrete operator.","Use a filtered/validated list builder."],"exampleFix":"// before\nOperator.createUnionCascade(first, new Operator[]{null, second});\n\n// after\nOperator.createUnionCascade(first, new Operator[]{second});  // null removed","handlingStrategy":"validation","validationCode":"if (input2 != null && input2.length > 0 && input2[0] == null) {\n    throw new IllegalArgumentException(\"input2[0] must not be null.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove null elements from operator arrays before calling createUnionCascade.","Ensure the first vararg is always a concrete operator.","Use Arrays.stream(...).filter(Objects::nonNull)."],"tags":["operators","null-check","union","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}