apache/pulsar · error · RestException
Tenant is not provided
Error message
Tenant is not provided
What it means
FunctionsImpl.registerFunction validates the request before contacting the broker and rejects it with HTTP 400 if the tenant path/query parameter is null. The tenant is the first segment of the function's qualified name and is mandatory for every registration.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:92
super(workerServiceSupplier, FunctionDetails.ComponentType.FUNCTION);
}
@Override
public void registerFunction(final String tenant,
final String namespace,
final String functionName,
final InputStream uploadedInputStream,
final FormDataContentDisposition fileDetail,
final String functionPkgUrl,
final FunctionConfig functionConfig,
final AuthenticationParameters authParams) {
if (!isWorkerServiceAvailable()) {
throwUnavailableException();
}
if (tenant == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Tenant is not provided");
}
if (namespace == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Namespace is not provided");
}
if (functionName == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Function name is not provided");
}
if (functionConfig == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Function config is not provided");
}
throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, functionName, "register", authParams);
try {
// Check tenant exists
worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
String qualifiedNamespace = tenant + "/" + namespace;View on GitHub (pinned to 820761864e)
Solutions
- Set tenant in the request path (and FunctionConfig.tenant) e.g. tenant 'public'
- Check the client call: client.newFunction().tenant(...)... must include .tenant()
- Print/inspect the FunctionConfig before submit to confirm tenant is populated
Example fix
// before
FunctionConfig cfg = new FunctionConfig(); cfg.setNamespace("default");
// after
FunctionConfig cfg = new FunctionConfig(); cfg.setTenant("public"); cfg.setNamespace("default"); Defensive patterns
Strategy: validation
Validate before calling
if (cfg.getTenant() == null || cfg.getTenant().isEmpty()) throw new IllegalArgumentException("tenant required"); Type guard
boolean hasTenant(FunctionConfig cfg) { return cfg != null && cfg.getTenant() != null && !cfg.getTenant().isEmpty(); } Try / catch
try { admin.functions().createFunction(...); }
catch (PulsarAdminException e) {
if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains("Tenant is not provided")) {
// set tenant and resubmit
}
} Prevention
- Always set tenant/namespace/name on FunctionConfig before submit
- Build REST URLs from a helper that asserts all path segments are non-empty
- Validate the config with a shared pre-submit checker in scripts/CI
When it happens
Trigger: Calling POST /admin/v3/functions/{tenant}/{namespace}/{functionName} or the Java/CLI registration API with the tenant field null or empty — typically a malformed URL path or a FunctionConfig built without setTenant().
Common situations: Building the REST URL by string concatenation and dropping a segment; deserializing a FunctionConfig JSON that lacks the tenant field; CLI scripts with an unset variable.
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
- <validation message from IllegalArgumentException>
- Namespace is not provided
- Function name is not provided
- Function config is not provided
- %s %s cannot be admitted:- %s
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/f60b960a7b15126c.
Report an issue: GitHub.