{"record":{"id":"da9894d666c34882","repo":"apache/flink","slug":"no-data-for-required-key","errorCode":null,"errorMessage":"No data for required key '{}'","messagePattern":"No data for required key '(.+?)'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/MultipleParameterTool.java","lineNumber":184,"sourceCode":"    /**\n     * Returns the Collection of String values for the given key. If the key does not exist it will\n     * return null.\n     */\n    public Collection<String> getMultiParameter(String key) {\n        addToDefaults(key, null);\n        unrequestedParameters.remove(key);\n        return data.getOrDefault(key, null);\n    }\n\n    /**\n     * Returns the Collection of String values for the given key. If the key does not exist it will\n     * throw a {@link RuntimeException}.\n     */\n    public Collection<String> getMultiParameterRequired(String key) {\n        addToDefaults(key, null);\n        Collection<String> value = getMultiParameter(key);\n        if (value == null) {\n            throw new RuntimeException(\"No data for required key '\" + key + \"'\");\n        }\n        return value;\n    }\n\n    // ------------------------- Export to different targets -------------------------\n\n    /**\n     * Return MultiMap of all the parameters processed by {@link MultipleParameterTool}.\n     *\n     * @return MultiMap of the {@link MultipleParameterTool}. Key is String and Value is a\n     *     Collection of String.\n     */\n    public Map<String, Collection<String>> toMultiMap() {\n        return data;\n    }\n\n    @Override\n    protected Object clone() throws CloneNotSupportedException {","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/MultipleParameterTool.java#L166-L202","documentation":"MultipleParameterTool is a ParameterTool variant that supports repeated keys (multi-values). getMultiParameterRequired(key) fetches all values for a key and throws RuntimeException when the key is absent from the parsed data — it marks the parameter as mandatory. The key string is included in the message.","triggerScenarios":"Calling getMultiParameterRequired(key) on a MultipleParameterTool built from args or properties where 'key' was never supplied (or supplied with a different spelling/case).","commonSituations":"CLI jobs run without a required argument (e.g. --input missing); key mismatch due to typos, casing, or leading dashes ('-k' vs '--key'); parameters loaded from a properties file that omitted the key; deprecated argument names after a refactor.","solutions":["Supply the missing key on the command line (e.g. --key value1 --key value2 for multi-parameters).","Check exact spelling/case of the key against what the program expects — ParameterTool matching is exact-string based.","If the parameter is optional in your flow, use getMultiParameter(key) and handle null instead of the Required variant.","Add usage/help text listing required keys and validate required args up front with a friendly message."],"exampleFix":"// before\nCollection<String> inputs = params.getMultiParameterRequired(\"input\");\n\n# run: flink run Job.jar --ouput /tmp/out   # 'input' missing -> RuntimeException\n\n// after: validate first\nif (params.getMultiParameter(\"input\") == null) {\n    System.err.println(\"Usage: Job --input <path> [--input <path>...]\");\n    return 1;\n}","handlingStrategy":"validation","validationCode":"Collection<String> values = params.getMultiParameter(key);\nif (values == null) {\n    throw new IllegalArgumentException(\"Missing required parameter --\" + key + \". Usage: ...\");\n}\nreturn values;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use getMultiParameter and null-check for optional args","Print usage text listing required keys on missing input","Match key spelling/case exactly between docs and code"],"tags":["cli","parameters","configuration","usage"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}