{"record":{"id":"3ae0ca8b452770d0","repo":"eclipse-vertx/vert.x","slug":"promise-already-completed","errorCode":null,"errorMessage":"Promise already completed","messagePattern":"Promise already completed","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"info","filePath":"vertx-core/src/main/java/io/vertx/core/Promise.java","lineNumber":87,"sourceCode":"   * Any handler set on the associated promise will be called.\n   *\n   * @param result  the result\n   * @throws IllegalStateException when the promise is already completed\n   */\n  default void complete(T result) {\n    if (!tryComplete(result)) {\n      throw new IllegalStateException(\"Result is already complete\");\n    }\n  }\n\n  /**\n   * Calls {@code complete(null)}\n   *\n   * @throws IllegalStateException when the promise is already completed\n   */\n  default void complete() {\n    if (!tryComplete(null)) {\n      throw new IllegalStateException(\"Promise already completed\");\n    }\n  }\n\n  default void succeed(T result) {\n    if (!tryComplete(result)) {\n      throw new IllegalStateException(\"Promise already completed\");\n    }\n  }\n\n  default void succeed() {\n    complete(null, null);\n  }\n\n  default void fail(Throwable failure) {\n    if (!tryFail(failure)) {\n      throw new IllegalStateException(\"Promise already completed\");\n    }\n  }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/Promise.java#L69-L105","documentation":"SC_HTTP_VERSION_NOT_SUPPORTED is an HttpResponseExpectation constant asserting an HTTP 505 status. As an expectation it fails responses whose status is not 505, surfacing '505 HTTP Version Not Supported'.","triggerScenarios":"Using HttpResponseExpectation.SC_HTTP_VERSION_NOT_SUPPORTED against a response with another status; verifying a server rejects an unsupported HTTP protocol version.","commonSituations":"Clients negotiating unusual HTTP versions (e.g. HTTP/2 or experimental versions) against servers supporting only HTTP/1.1; protocol-compatibility test suites.","solutions":["Have the client use an HTTP version the server supports (e.g. force HTTP/1.1) or upgrade the server/proxy.","Fix the expectation to the status actually returned if 505 was not the intent.","For version-capability tests, keep SC_HTTP_VERSION_NOT_SUPPORTED and send the unsupported version deliberately."],"exampleFix":"// before\nrequest.expect(HttpResponseExpectation.SC_HTTP_VERSION_NOT_SUPPORTED).send();\n// after\nclient.options().setProtocolVersion(HttpVersion.HTTP_1_1);\nrequest.expect(HttpResponseExpectation.status(200)).send();","handlingStrategy":"fallback","validationCode":"HttpVersion v = client.options().getProtocolVersion();\nif (v != HttpVersion.HTTP_1_1 && !serverSupports(v)) client.options().setProtocolVersion(HttpVersion.HTTP_1_1);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the HTTP version explicitly in client options when the server only supports HTTP/1.1.","Verify proxy/ALPN configuration before enabling HTTP/2.","Keep server and client stacks on tested Vert.x/protocol versions."],"tags":["http","protocol-version","expectation"],"backgroundTag":"http-error-status","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}