quarkusio/quarkus · error · RuntimeException

CardAction requires either jsonRpcMethodName() or url()

Error message

CardAction requires either jsonRpcMethodName() or url()

What it means

CardActionBuilder.build() requires an actionType plus a non-empty actionReference. An action must point somewhere — either a JSON-RPC method name (jsonRpcMethodName(...)) or a URL (url(...)). Building without either leaves the Dev UI button with no target, so the library fails fast.

Source

Thrown at extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/CardActionBuilder.java:52

    }

    public CardActionBuilder url(String url) {
        this.actionType = CardAction.ActionType.URL;
        this.actionReference = url;
        return this;
    }

    public CardActionBuilder showResultNotification(boolean show) {
        this.showResultNotification = show;
        return this;
    }

    public CardAction build() {
        if (title == null || title.isEmpty()) {
            throw new RuntimeException("CardAction title is required");
        }
        if (actionType == null || actionReference == null || actionReference.isEmpty()) {
            throw new RuntimeException("CardAction requires either jsonRpcMethodName() or url()");
        }
        return new CardAction(title, icon, tooltip,
                actionType, actionReference, showResultNotification);
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Call either jsonRpcMethodName("myRpcMethod") or url("https://...") on the builder before build()
  2. Ensure the JSON-RPC method exists in a @JsonRpc class registered for Dev UI and its name matches exactly
  3. If the target is conditional, guard build() and skip creating the CardAction entirely when neither target is available
  4. Log/assert the builder state in tests that construct Dev UI pages

Example fix

// before
CardAction action = new CardActionBuilder()
        .title("Refresh")
        .build(); // throws
// after
CardAction action = new CardActionBuilder()
        .title("Refresh")
        .jsonRpcMethodName("refreshData")
        .build();
Defensive patterns

Strategy: validation

Validate before calling

boolean ready = (title != null && !title.isEmpty())
    && ((rpcMethod != null && !rpcMethod.isEmpty()) || (url != null && !url.isEmpty()));
if (!ready) throw new IllegalStateException("CardAction needs a title and a jsonRpcMethodName or url");

Type guard

boolean hasActionTarget(CardAction a) {
    return a != null && a.getActionReference() != null && !a.getActionReference().isEmpty();
}

Try / catch

try {
    return builder.build();
} catch (RuntimeException e) {
    if (e.getMessage().contains("jsonRpcMethodName() or url()")) {
        log.warn("CardAction built without target, skipping");
        return null;
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling CardActionBuilder.build() after setting only title/icon/tooltip/showResultNotification, or calling jsonRpcMethodName(null) / url("") so actionType or actionReference stays null/empty.

Common situations: Extension authors defining card action buttons but forgetting to wire the click target; conditional code where both url() and jsonRpcMethodName() calls are skipped at runtime; refactors that renamed the RPC method string to an empty variable.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/3f57b7d4a2280561. Report an issue: GitHub.