{"record":{"id":"7150f38a1dd6efaa","repo":"eclipse-vertx/vert.x","slug":"invalid-setting","errorCode":null,"errorMessage":"Invalid setting","messagePattern":"Invalid setting","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/HttpSettings.java","lineNumber":67,"sourceCode":"   * @return a reference to this, so the API can be used fluently\n   */\n  public <T> HttpSettings set(HttpSetting<T> setting, T value) {\n    if (value == null) {\n      throw new NullPointerException(\"No null value accepted\");\n    }\n    return setLong(setting, setting.to.convert(value));\n  }\n\n  /**\n   * Get the {@code setting } value as {@code <T>}.\n   *\n   * @param setting the setting\n   * @return the value or {@code null} if the value is not present\n   */\n  public <T> T get(HttpSetting<T> setting) {\n    HttpVersion version = version();\n    if (!setting.versions.contains(version)) {\n      throw new IllegalArgumentException(\"Invalid setting\");\n    }\n    Long value = getLong(setting);\n    return value != null ? setting.from.convert(value) : null;\n  }\n\n  /**\n   * Get the {@code setting } value as {@code <T>}.\n   *\n   * @param setting the setting\n   * @return the value, which is never {@code null} since the setting default value will be returned instead\n   */\n  public <T> T getOrDefault(HttpSetting<T> setting) {\n    HttpVersion version = version();\n    if (!setting.versions.contains(version)) {\n      throw new IllegalArgumentException(\"Invalid setting\");\n    }\n    long value = getLongOrDefault(setting);\n    return setting.from.convert(value);","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/HttpSettings.java#L49-L85","documentation":"HttpSettings.get() only works for settings applicable to the HttpVersion of this settings object (HTTP/1.x, HTTP/2, or HTTP/3). Each HttpSetting declares which protocol versions support it; if the current version is not among setting.versions, the lookup is invalid and Vert.x throws this IllegalArgumentException rather than returning a misleading null.","triggerScenarios":"Calling httpSettings.get(someHttp2Setting) (e.g. Http2Settings.HTTP2_MAX_FRAME_SIZE) on a settings object whose version() is HTTP/1.x, or vice versa, e.g. querying an HTTP/2-only setting on a client configured for HTTP/1.1.","commonSituations":"Reading client settings generically over a list of HttpSettings without checking protocol version; sharing a settings object between an HTTP/1.1 client and an HTTP/2 client; tests like testClientSettings querying settings across versions.","solutions":["Check that the setting applies to the settings version before reading: verify the HttpSetting was declared for the active HttpVersion (e.g. only use Http2Settings.* entries on HTTP/2 settings).","Filter the setting list by version support before iterating, e.g. skip settings whose supported versions do not contain settings.version().","If you need a value across protocols, read it from a settings object with the matching version."],"exampleFix":"// before\nLong v = settings.get(Http2Settings.HTTP2_MAX_FRAME_SIZE); // settings is HTTP/1.x\n// after\nif (settings.version() == HttpVersion.HTTP_2) {\n  Long v = settings.get(Http2Settings.HTTP2_MAX_FRAME_SIZE);\n}","handlingStrategy":"validation","validationCode":"if (settings.version() != null && setting.supportedVersions().contains(settings.version())) {\n  Long v = settings.get(setting);\n}","typeGuard":"boolean isApplicable(HttpSettings s, HttpSetting<?> st) { return st.supportedVersions().contains(s.version()); }","tryCatchPattern":"try { Long v = settings.get(setting); } catch (IllegalArgumentException e) { /* setting not valid for this protocol version */ }","preventionTips":["Keep HTTP/1.1, HTTP/2, and HTTP/3 settings in separate code paths or maps keyed by version.","Filter setting lists by version before iteration.","Check which HttpSetting constants belong to Http2Settings/Http3Settings vs shared settings."],"tags":["http","settings","illegal-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}