apache/pulsar · error · IllegalArgumentException

Namespace is not provided

Error message

Namespace is not provided

What it means

An IllegalArgumentException thrown by ComponentImpl.validateListFunctionRequestParams when the namespace parameter is null while listing functions/sinks/sources. The worker requires both tenant and namespace to compose the namespace the components belong to.

Source

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

                        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,
                                                    FunctionDetails.ComponentType componentType)
            throws IllegalArgumentException {

View on GitHub (pinned to 820761864e)

Solutions

  1. Provide the namespace argument (e.g. 'default') in the list request
  2. Fix the caller's configuration/property wiring that left namespace null
  3. Validate request parameters client-side before invoking the API

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
    return admin.functions().listFunctions(tenant, namespace);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Namespace is not provided")) {
        namespace = "default";
        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 valid tenant but null namespace.

Common situations: Config file or env var for the namespace missing; programmatic request object built with only the tenant set; URL path truncation producing a null path parameter.

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/d5788f4ddaaa7450. Report an issue: GitHub.