{"record":{"id":"36993e1b72a48ecd","repo":"apache/flink","slug":"could-not-parse-value-for-key-s","errorCode":null,"errorMessage":"Could not parse value for key '%s'.","messagePattern":"Could not parse value for key '(.+?)'\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/configuration/Configuration.java","lineNumber":378,"sourceCode":"     */\n    @PublicEvolving\n    public <T> T get(ConfigOption<T> configOption, T overrideDefault) {\n        return getOptional(configOption).orElse(overrideDefault);\n    }\n\n    @Override\n    public <T> Optional<T> getOptional(ConfigOption<T> option) {\n        Optional<Object> rawValue = getRawValueFromOption(option);\n        Class<?> clazz = option.getClazz();\n\n        try {\n            if (option.isList()) {\n                return rawValue.map(v -> ConfigurationUtils.convertToList(v, clazz));\n            } else {\n                return rawValue.map(v -> ConfigurationUtils.convertValue(v, clazz));\n            }\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\n                    GlobalConfiguration.isSensitive(\n                                    option.key(),\n                                    this.get(SecurityOptions.ADDITIONAL_SENSITIVE_KEYS))\n                            ? String.format(\"Could not parse value for key '%s'.\", option.key())\n                            : String.format(\n                                    \"Could not parse value '%s' for key '%s'.\",\n                                    rawValue.map(Object::toString).orElse(\"\"), option.key()),\n                    e);\n        }\n    }\n\n    @Override\n    public <T> Configuration set(ConfigOption<T> option, T value) {\n        final boolean canBePrefixMap = canBePrefixMap(option);\n        setValueInternal(option.key(), value, canBePrefixMap);\n        return this;\n    }\n","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L360-L396","documentation":"Configuration.getOptional(option) converts the raw value to the option's type; if conversion throws, Flink reports a parse error. This variant (without the value echoed) is used when the option key is considered SENSITIVE — GlobalConfiguration.isSensitive(key, additionalSensitiveKeys) matched (e.g. keys containing 'password', 'secret', 'token', or listed in security.additional-sensitive-keys) — so the raw value is deliberately omitted from the message to avoid leaking credentials into logs.","triggerScenarios":"A sensitive option (password/secret/token-like key) whose configured value cannot be parsed into the option's type: a malformed duration ('10 secondz'), malformed memory size ('1gbx'), non-numeric string for an int option, or bad list syntax.","commonSituations":"Typing a wrong unit in 'security.ssl.keystore-password'-adjacent duration/size options; copy-pasting a value with trailing whitespace or quotes into flink-conf.yaml for a typed sensitive option; a custom option named like a secret but declared with a non-string type.","solutions":["Fix the value's syntax: durations as '10 s'/'60 s'/ISO-8601, memory as '1 gb', numbers plain; check the option's declared type.","Check for stray quotes/whitespace introduced by YAML formatting around the sensitive value.","If you genuinely need the value echoed for debugging, temporarily read it via conf.getString on a non-sensitive alias or check the file directly — never commit the fix with the secret printed.","For custom options, avoid sensitive-sounding key names unless the value really is secret."],"exampleFix":"# before\nmetrics.reporter.prom.token.duration: 10 secondz  # unparseable duration\n\n# after\nmetrics.reporter.prom.token.duration: 10 s","handlingStrategy":"validation","validationCode":"// Validate syntax before getOptional for duration-like options:\nstatic boolean validDuration(String v) {\n    return v == null || v.matches(\"(\\\\d+(\\\\.\\\\d+)?\\\\s*(ns|ms|s|min|min|h|d)\\\\s*)+|P.*\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint config files for unit syntax ('10 s' not '10sec') in CI.","Remember sensitive keys mask the value in errors — check the config file directly when debugging.","Never log the resolved value of sensitive keys yourself."],"tags":["configuration","parse-error","sensitive-keys","security","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}