{"record":{"id":"0f407151ddc8652a","repo":"apache/flink","slug":"the-broadcast-input-name-may-not-be-null","errorCode":null,"errorMessage":"The broadcast input name may not be null.","messagePattern":"The broadcast input name may not be null\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/operators/AbstractUdfOperator.java","lineNumber":92,"sourceCode":"\n    /**\n     * Returns the input, or null, if none is set.\n     *\n     * @return The broadcast input root operator.\n     */\n    public Map<String, Operator<?>> getBroadcastInputs() {\n        return this.broadcastInputs;\n    }\n\n    /**\n     * Binds the result produced by a plan rooted at {@code root} to a variable used by the UDF\n     * wrapped in this operator.\n     *\n     * @param root The root of the plan producing this input.\n     */\n    public void setBroadcastVariable(String name, Operator<?> root) {\n        if (name == null) {\n            throw new IllegalArgumentException(\"The broadcast input name may not be null.\");\n        }\n        if (root == null) {\n            throw new IllegalArgumentException(\n                    \"The broadcast input root operator may not be null.\");\n        }\n\n        this.broadcastInputs.put(name, root);\n    }\n\n    /**\n     * Clears all previous broadcast inputs and binds the given inputs as broadcast variables of\n     * this operator.\n     *\n     * @param inputs The {@code<name, root>} pairs to be set as broadcast inputs.\n     */\n    public <T> void setBroadcastVariables(Map<String, Operator<T>> inputs) {\n        this.broadcastInputs.clear();\n        this.broadcastInputs.putAll(inputs);","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/operators/AbstractUdfOperator.java#L74-L110","documentation":"Thrown by AbstractUdfOperator.setBroadcastVariable(String name, Operator<?> root) when the name argument is null. Broadcast variable names are keys in the broadcastInputs map; a null key would break lookup and iteration, so the API rejects it early with an IllegalArgumentException.","triggerScenarios":"Calling setBroadcastVariable(null, someOperator) directly, or passing a variable that was computed (e.g., from a map lookup) and turned out null. In programmatic plan construction (rare for end users, more common in internal operator wiring), a null name string is passed.","commonSituations":"This is an @Internal API rarely called directly by application developers. It is hit when building operator plans programmatically at the low-level operator layer rather than using the higher-level DataSet/DataStream API, or in tests that construct operator graphs manually.","solutions":["Ensure the broadcast variable name string is non-null before calling setBroadcastVariable(). Validate or default the name.","If using the high-level API (withBroadcastSet(dataSet, \"name\")), verify the string literal is never null.","If the name comes from dynamic input (config, map key), add a null check and provide a meaningful default or fail with a clearer upstream error."],"exampleFix":"// before\nop.setBroadcastVariable(name, root);  // name may be null\n// after\nif (name == null) {\n    throw new IllegalArgumentException(\"broadcast name must not be null for operator \" + op.getName());\n}\nop.setBroadcastVariable(name, root);","handlingStrategy":"validation","validationCode":"if (name == null) {\n    throw new IllegalArgumentException(\"Broadcast variable name must not be null\");\n}\nop.setBroadcastVariable(name, root);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a non-null string literal for broadcast variable names.","If the name comes from dynamic input, validate it before calling setBroadcastVariable().","Use the high-level API withBroadcastSet(dataSet, \"name\") which enforces non-null at the API boundary."],"tags":["broadcast-variable","null-check","flink-core","internal-api"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}