apache/pulsar · error · RuntimeException

Supplier is not specified!

Error message

Supplier is not specified!

What it means

Actions.verifyAction requires each Action to have a supplier that performs the actual work and yields an ActionResult. If the supplier was never set on the builder, verifyAction throws this RuntimeException, since an action without work cannot be executed.

Source

Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/Actions.java:53

    @Data
    @Builder(toBuilder = true)
    public static class Action {
        private String actionName;
        @Builder.Default
        private int numRetries = 1;
        private Supplier<ActionResult> supplier;
        @Builder.Default
        private long sleepBetweenInvocationsMs = 500;
        private Boolean continueOn;
        private Consumer<ActionResult> onFail;
        private Consumer<ActionResult> onSuccess;

        public void verifyAction() {
            if (isBlank(actionName)) {
                throw new RuntimeException("Action name is empty!");
            }
            if (supplier == null) {
                throw new RuntimeException("Supplier is not specified!");
            }
        }
    }

    @Data
    @Builder
    public static class ActionResult {
        private boolean success;
        private String errorMsg;
        private Object result;
    }

    private Actions() {

    }


    public Actions addAction(Action action) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Set the supplier on the builder: Action.builder().actionName("x").supplier(() -> doWork())...
  2. Ensure the code path that sets the supplier is actually executed (no early return / wrong branch)
  3. If the action intentionally does no work, supply a no-op supplier returning a completed ActionResult

Example fix

// before
Action.builder().actionName("noop").build();
// after
Action.builder().actionName("noop").supplier(() -> ActionResult.builder().success(true).build()).build();
Defensive patterns

Strategy: validation

Validate before calling

if (supplier == null) {
    throw new IllegalArgumentException("Action supplier must be set before building Action");
}

Type guard

static boolean hasSupplier(Actions.Action action) {
    return action != null && action.getSupplier() != null;
}

Try / catch

try {
    action.verifyAction();
} catch (RuntimeException e) {
    if (e.getMessage().equals("Supplier is not specified!")) { /* add .supplier(...) to the builder */ }
}

Prevention

When it happens

Trigger: Building an Action with Action.builder().actionName("x").build() (no .supplier(...)) and registering it through ActionChainBuilder.addAction, which calls verifyAction and finds supplier == null.

Common situations: copying an action template and deleting the lambda; conditional builder code paths that skip setting the supplier; refactoring where the supplier moved into another builder method no longer called.

Understand the failure class

Background: "X is required", "field cannot be empty", error-the-field-is-required: missing required-field validation errors, explained — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/871e69f84ae2bf7f. Report an issue: GitHub.