{"record":{"id":"794d26ef192f845e","repo":"apache/flink","slug":"no-data-for-required-key-key","errorCode":null,"errorMessage":"No data for required key '{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/AbstractParameterTool.java","lineNumber":79,"sourceCode":"    protected abstract int getNumberOfParameters();\n\n    /**\n     * Returns the String value for the given key. If the key does not exist it will return null.\n     */\n    protected abstract String get(String key);\n\n    /** Check if value is set. */\n    public abstract boolean has(String value);\n\n    /**\n     * Returns the String value for the given key. If the key does not exist it will throw a {@link\n     * RuntimeException}.\n     */\n    public String getRequired(String key) {\n        addToDefaults(key, null);\n        String value = get(key);\n        if (value == null) {\n            throw new RuntimeException(\"No data for required key '\" + key + \"'\");\n        }\n        return value;\n    }\n\n    /**\n     * Returns the String value for the given key. If the key does not exist it will return the\n     * given default value.\n     */\n    public String get(String key, String defaultValue) {\n        addToDefaults(key, defaultValue);\n        String value = get(key);\n        if (value == null) {\n            return defaultValue;\n        } else {\n            return value;\n        }\n    }\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/AbstractParameterTool.java#L61-L97","documentation":"Thrown by AbstractParameterTool.getRequired(String key) when the key has no value. ParameterTool is Flink's utility for passing program arguments (parsed with ParameterTool.fromArgs), and getRequired enforces mandatory parameters by throwing an unchecked RuntimeException at access time.","triggerScenarios":"Calling parameterTool.getRequired(\"input\") when 'input' was never passed via --input ..., when the key has a typo (e.g. --inptu), or when the tool was built from a properties file that lacks the key.","commonSituations":"Missing or misspelled command-line arguments in a Flink job submission; environment-specific config files that omit a key that production supplies; a key present in one environment profile but not another.","solutions":["Check the actual command line/properties for the missing or misspelled key and pass it","Use has(key) or get(key, defaultValue) when the parameter is optional instead of required","Call getRequired for all mandatory keys once at startup with a clear usage message, so failures happen before the job is submitted"],"exampleFix":"// before\nString input = params.getRequired(\"input\");\n\n// after\nif (!params.has(\"input\")) {\n    throw new IllegalArgumentException(\"Missing required argument '--input <path>'\");\n}\nString input = params.getRequired(\"input\");","handlingStrategy":"validation","validationCode":"if (!params.has(\"input\")) {\n    throw new IllegalArgumentException(\"Missing required parameter '--input'\");\n}\nString input = params.getRequired(\"input\");","typeGuard":null,"tryCatchPattern":"Optionally wrap getRequired calls in a try/catch (RuntimeException e) at program start to print usage text and exit non-zero instead of a stack trace.","preventionTips":["Validate all required keys once in main() before execute() so the job fails at submission, not mid-run","Prefer getRequired over get for mandatory params so absence is loud, and prefer get(key, default) for optional ones"],"tags":["flink-core","configuration","parameter-tool","startup"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}