apache/pulsar · error · IllegalArgumentException

Tenant is not provided

Error message

Tenant is not provided

What it means

An IllegalArgumentException thrown by ComponentImpl.validateListFunctionRequestParams when the tenant parameter is null while listing functions/sinks/sources in a namespace. It is a fail-fast guard so the worker never queries the function metadata store with an incomplete fully-qualified name.

Source

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

                String componentName = tokens[2];

                throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, componentName, "download package for",
                        authParams);
            } else {
                if (!isSuperUser(authParams)) {
                    throw new RestException(Status.UNAUTHORIZED, "Client is not authorized to perform operation");
                }
            }
        }

        return getStreamingOutput(path);
    }

    private void validateListFunctionRequestParams(final String tenant, final String namespace)
            throws IllegalArgumentException {

        if (tenant == null) {
            throw new IllegalArgumentException("Tenant is not provided");
        }
        if (namespace == null) {
            throw new IllegalArgumentException("Namespace is not provided");
        }
    }

    protected void validateGetFunctionInstanceRequestParams(final String tenant,
                                                            final String namespace,
                                                            final String componentName,
                                                            final FunctionDetails.ComponentType componentType,
                                                            final String instanceId) throws IllegalArgumentException {
        validateGetFunctionRequestParams(tenant, namespace, componentName, componentType);
        if (instanceId == null) {
            throw new IllegalArgumentException(String.format("%s Instance Id is not provided", componentType));
        }
    }

    protected void validateGetFunctionRequestParams(String tenant, String namespace, String subject,

View on GitHub (pinned to 820761864e)

Solutions

  1. Supply a non-null tenant in the list request (e.g. public/default)
  2. Fix the client configuration so the tenant value is read and passed correctly
  3. Validate inputs on the caller side before invoking the admin API

Example fix

// before
admin.functions().listFunctions(null, "default");
// after
admin.functions().listFunctions("public", "default");
Defensive patterns

Strategy: validation

Validate before calling

if (tenant == null || tenant.isEmpty()) {
    throw new IllegalArgumentException("tenant must be provided before listing functions");
}

Type guard

static boolean hasTenant(String tenant) {
    return tenant != null && !tenant.trim().isEmpty();
}

Try / catch

try {
    return admin.functions().listFunctions(tenant, namespace);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Tenant is not provided")) {
        tenant = resolveDefaultTenant();
        return admin.functions().listFunctions(tenant, namespace);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling listFunctions (REST GET .../functions/{tenant}/{namespace} or the Java admin API) with a null tenant argument, e.g. from a programmatically built request where the tenant field was never populated.

Common situations: Client code building a ListFunction request from parsed config where the tenant key is absent; REST call with empty path segments mapped to null; SDK versions where defaults were not applied.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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