{"record":{"id":"89b0e9f68dabf226","repo":"eclipse-vertx/vert.x","slug":"supplied-deployable-is-null","errorCode":null,"errorMessage":"Supplied deployable is null","messagePattern":"Supplied deployable is null","errorType":"exception","errorClass":"VertxException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/impl/deployment/DefaultDeployment.java","lineNumber":49,"sourceCode":"public class DefaultDeployment implements Deployment {\n\n  public static DefaultDeployment deployment(VertxImpl vertx,\n                                             Logger log,\n                                             DeploymentOptions options,\n                                             Function<Deployable, String> identifierProvider,\n                                             ClassLoader tccl,\n                                             Callable<? extends Deployable> supplier) throws Exception {\n    int numberOfInstances = options.getInstances();\n    Set<Deployable> deployables = Collections.newSetFromMap(new IdentityHashMap<>());\n    for (int i = 0; i < numberOfInstances;i++) {\n      Deployable deployable;\n      try {\n        deployable = supplier.call();\n      } catch (Exception e) {\n        throw e;\n      }\n      if (deployable == null) {\n        throw new VertxException(\"Supplied deployable is null\", true);\n      }\n      deployables.add(deployable);\n    }\n    if (deployables.size() != numberOfInstances) {\n      throw new VertxException(\"Same deployable supplied more than once\", true);\n    }\n    CloseableResource<WorkerPool> workerPool = null;\n    ThreadingModel mode = options.getThreadingModel();\n    if (mode == null) {\n      mode = ThreadingModel.EVENT_LOOP;\n    }\n    if (mode != ThreadingModel.VIRTUAL_THREAD) {\n      if (options.getWorkerPoolName() != null) {\n        workerPool = vertx.createSharedWorkerPool(options.getWorkerPoolName(), options.getWorkerPoolSize(), options.getMaxWorkerExecuteTime(), options.getMaxWorkerExecuteTimeUnit());\n      }\n    } else {\n      if (!vertx.isVirtualThreadAvailable()) {\n        throw new VertxException(\"This Java runtime does not support virtual threads\", true);","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/impl/deployment/DefaultDeployment.java#L31-L67","documentation":"During deployment Vert.x calls the deployable supplier for each instance; if the supplier returns null the framework cannot deploy a non-existent verticle and throws VertxException('Supplied deployable is null'). This catches suppliers that construct a verticle but return null instead of the instance.","triggerScenarios":"deployVerticle(Supplier<Verticle>, DeploymentOptions) where the supplier returns null — e.g. a factory method that fails silently and returns null, or a lambda returning the result of a nullable lookup.","commonSituations":"Verticle factories with conditional creation paths returning null when a type isn't recognized; refactored suppliers whose return was dropped; DI frameworks returning null for missing beans.","solutions":["Ensure the supplier always returns a non-null Verticle instance","Add an assertion/Objects.requireNonNull inside the supplier to fail with a clearer message","If creation can fail legitimately, throw a descriptive exception from the supplier instead of returning null"],"exampleFix":"// before\nvertx.deployVerticle(() -> maybeCreateVerticle(type), opts); // returns null for unknown type\n// after\nvertx.deployVerticle(() -> {\n  Verticle v = maybeCreateVerticle(type);\n  if (v == null) throw new IllegalStateException(\"Unknown verticle type: \" + type);\n  return v;\n}, opts);","handlingStrategy":"validation","validationCode":"Supplier<Verticle> sup = () -> {\n  Verticle v = factory.create(type);\n  return Objects.requireNonNull(v, \"factory returned null for \" + type);\n};","typeGuard":null,"tryCatchPattern":"try {\n  vertx.deployVerticle(sup, opts).await();\n} catch (VertxException e) {\n  // inspect supplier: returned null deployable\n}","preventionTips":["Ensure verticle factories always return an instance or throw","Add Objects.requireNonNull inside suppliers","Avoid nullable lookups as supplier return values"],"tags":["deployment","null","supplier","verticle"],"backgroundTag":"null-argument","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"}