{"record":{"id":"f7220b7a07b138ba","repo":"eclipse-vertx/vert.x","slug":"unit-must-not-be-null","errorCode":null,"errorMessage":"Unit must not be null","messagePattern":"Unit must not be null","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"info","filePath":"vertx-core/src/main/java/io/vertx/core/Future.java","lineNumber":783,"sourceCode":"   * @throws IllegalStateException when the current thread must be parked and this method is called from a Vert.x event-loop or worker thread.\n   */\n  @GenIgnore(GenIgnore.PERMITTED_TYPE)\n  default T await(Duration timeout) throws TimeoutException {\n    return await(timeout.toMillis(), TimeUnit.MILLISECONDS);\n  }\n\n  /**\n   * Like {@link #await()} but with a timeout.\n   *\n   * @param timeout the timeout\n   * @param unit the timeout unit\n   * @return the result when this {@link Future} is completed\n   * @throws TimeoutException when the timeout fires before the future completes\n   * @throws IllegalStateException when the current thread must be parked and this method is called from a Vert.x event-loop or worker thread.\n   */\n  default T await(long timeout, TimeUnit unit) throws TimeoutException {\n    if (unit == null) {\n      throw new NullPointerException(\"Unit must not be null\");\n    }\n    CountDownLatch continuation = trySuspend();\n    if (continuation != null) {\n      try {\n        if (!continuation.await(timeout, unit)) {\n          throw new TimeoutException();\n        }\n      } catch (InterruptedException e) {\n        Utils.throwAsUnchecked(e);\n        return null;\n      }\n    }\n    return getOrFail();\n  }\n\n  /**\n   * Calls {@link #await()} on {@code future}.\n   *","sourceCodeStart":765,"sourceCodeEnd":801,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/Future.java#L765-L801","documentation":"SC_SERVICE_UNAVAILABLE is an HttpResponseExpectation constant asserting an HTTP 503 status. It is a validation handle, not a thrown error; the '503 Service Unavailable' message appears when an expectation check against it fails (or when code maps a 503 response for reporting).","triggerScenarios":"Using request.expect(HttpResponseExpectation.SC_SERVICE_UNAVAILABLE) with a response whose status is not 503; matching responses with status 503 during overload/maintenance.","commonSituations":"A backend under load or in maintenance returns 503 while the caller expected success; retry/circuit-breaker tests that intentionally return 503; service mesh signaling temporary unavailability.","solutions":["Retry the request with backoff since 503 usually indicates temporary unavailability (check Retry-After header).","If a success was expected, address server capacity/health so it stops returning 503.","Keep SC_SERVICE_UNAVAILABLE only where 503 is the intended contract; otherwise replace with the appropriate status expectation."],"exampleFix":"// before\nrequest.expect(HttpResponseExpectation.SC_SERVICE_UNAVAILABLE).send();\n// after\nrequest.expect(HttpResponseExpectation.SC_OK).send();","handlingStrategy":"retry","validationCode":"if (response.statusCode() == 503) {\n  long waitMs = response.getHeader(\"Retry-After\") != null ? Long.parseLong(response.getHeader(\"Retry-After\")) * 1000 : 1000;\n  // schedule retry after waitMs\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Respect the Retry-After header when a 503 occurs.","Use circuit breakers so a 503-serving backend does not cascade failures.","Keep maintenance windows and health checks aligned with client retries."],"tags":["http","status-code","service-unavailable","retry"],"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-14T00:17:10.932Z"}