apache/pulsar · warning · RestException

<validation message from IllegalArgumentException>

Error message

<validation message from IllegalArgumentException>

What it means

deregisterFunction validates the tenant/namespace/componentName arguments via an internal validation method that throws IllegalArgumentException; ComponentImpl catches it and converts it to HTTP 400 BAD_REQUEST RestException carrying the validation message. It indicates a malformed or invalid deregister request, not a missing function.

Source

Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:464

                                   final AuthenticationParameters authParams) {

        if (!isWorkerServiceAvailable()) {
            throwUnavailableException();
        }

        throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, componentName, "deregister",
                authParams);

        // validate parameters
        try {
            validateDeregisterRequestParams(tenant, namespace, componentName, componentType);
        } catch (IllegalArgumentException e) {
            log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)

                    .attr("namespace", namespace).attr("componentName", componentName).exception(e)

                    .log("Invalid deregister request @ / / /");
            throw new RestException(Status.BAD_REQUEST, e.getMessage());
        }

        FunctionMetaDataManager functionMetaDataManager = worker().getFunctionMetaDataManager();
        if (!functionMetaDataManager.containsFunction(tenant, namespace, componentName)) {
            log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)

                    .attr("namespace", namespace).attr("componentName", componentName)

                    .log("to deregister does not exist @ / / /");
            throw new RestException(Status.NOT_FOUND,
                    String.format("%s %s doesn't exist", ComponentTypeUtils.toString(componentType), componentName));
        }
        FunctionMetaData functionMetaData =
                functionMetaDataManager.getFunctionMetaData(tenant, namespace, componentName);

        if (!InstanceUtils.calculateSubjectType(functionMetaData.getFunctionDetails()).equals(componentType)) {
            log.error().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", componentName)

View on GitHub (pinned to 820761864e)

Solutions

  1. Check the request: ensure tenant, namespace, and component name are non-empty and valid (no illegal characters, correct case).
  2. Fix the client/CLI invocation or URL template so parameters are properly populated and encoded.
  3. Validate inputs before calling the API (null/empty/regex checks).

Example fix

// before
admin.functions().deleteFunction(tenant, ns, null); // NPE -> IllegalArgumentException -> 400
// after
if (tenant == null || ns == null || fn == null || fn.isBlank()) {
    throw new IllegalArgumentException("tenant, namespace and function name are required");
}
admin.functions().deleteFunction(tenant, ns, fn);
Defensive patterns

Strategy: validation

Validate before calling

// validate parameters before calling deregister
Objects.requireNonNull(tenant, "tenant required");
Objects.requireNonNull(namespace, "namespace required");
Objects.requireNonNull(componentName, "component name required");
if (tenant.isBlank() || namespace.isBlank() || componentName.isBlank()
        || !componentName.matches("[a-zA-Z0-9_:-]+")) {
    throw new IllegalArgumentException("Invalid tenant/namespace/name");
}

Try / catch

try {
    deregisterFunction(tenant, namespace, componentName, componentType);
} catch (RestException e) {
    if (e.getResponse().getStatus() == 400) {
        // fix request parameters per e.getMessage()
    }
    throw e;
}

Prevention

When it happens

Trigger: Deregistering a function/sink/source with missing or malformed tenant, namespace, or name (null, empty string, illegal characters); wrong component type parameters; API misuse where path/query parameters are not populated.

Common situations: Client code building the REST URL with blank variables; names containing invalid characters (slashes, spaces); SDK/CLI versions passing null for optional parameters; automation templates with unexpanded placeholders.

Related errors


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