apache/pulsar · error · RestException
Namespace is not provided
Error message
Namespace is not provided
What it means
registerFunction rejects the request with HTTP 400 when the namespace parameter is null. Tenant/namespace/functionName form the function's fully qualified name, so all three must be present before any further validation.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:95
@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;
List<String> namespaces = worker().getBrokerAdmin().namespaces().getNamespaces(tenant);
if (namespaces != null && !namespaces.contains(qualifiedNamespace)) {
String qualifiedNamespaceWithCluster = String.format("%s/%s/%s", tenant,View on GitHub (pinned to 820761864e)
Solutions
- Provide the namespace in the URL path and FunctionConfig (commonly 'default')
- Verify tenant/namespace exist via 'pulsar-admin namespaces list <tenant>'
- Fix script/tooling that builds the request so the namespace variable is expanded
Example fix
// before admin.functions().createFunction(tenant, null, fnName, pkg, cfg, null); // after admin.functions().createFunction(tenant, "default", fnName, pkg, cfg, null);
Defensive patterns
Strategy: validation
Validate before calling
if (cfg.getNamespace() == null || cfg.getNamespace().isEmpty()) throw new IllegalArgumentException("namespace required"); Type guard
boolean hasNamespace(FunctionConfig cfg) { return cfg != null && cfg.getNamespace() != null && !cfg.getNamespace().isEmpty(); } Try / catch
try { admin.functions().createFunction(...); }
catch (PulsarAdminException e) {
if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains("Namespace is not provided")) {
// set namespace (e.g. "default") and resubmit
}
} Prevention
- Default namespace to "default" in tooling when unset
- Assert all three name components before registration
- Log the fully qualified name tenant/namespace/name at submit time
When it happens
Trigger: POST /admin/v3/functions/{tenant}/{namespace}/{functionName} with a null/missing namespace segment, or FunctionConfig created without setNamespace().
Common situations: URL template with a missing path segment; JSON config missing namespace; variables not expanded in deployment scripts.
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>
- Tenant 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/66cc242ed5bedfac.
Report an issue: GitHub.