apache/pulsar · warning · RestException
Tenant is not provided
Error message
Tenant is not provided
What it means
registerSource performs basic parameter validation before doing any work. If the tenant path parameter is null, it returns HTTP 400 'Tenant is not provided'. It is a plain required-argument check on the REST endpoint.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:90
super(workerServiceSupplier, FunctionDetails.ComponentType.SOURCE);
}
@Override
public void registerSource(final String tenant,
final String namespace,
final String sourceName,
final InputStream uploadedInputStream,
final FormDataContentDisposition fileDetail,
final String sourcePkgUrl,
final SourceConfig sourceConfig,
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 (sourceName == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Source name is not provided");
}
if (sourceConfig == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Source config is not provided");
}
throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, sourceName, "register", authParams);
try {
// Check tenant exists
worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
String qualifiedNamespace = tenant + "/" + namespace;View on GitHub (pinned to 820761864e)
Solutions
- Include a valid tenant in the URL path: POST /admin/v3/sources/<tenant>/<namespace>/<name>.
- Create the tenant first if it does not exist: pulsar-admin tenants create <tenant>.
- Check deployment scripts so the tenant variable is non-empty before invoking the API.
Example fix
// before
admin.sources().createSource(null, namespace, sourceName, fileName, config); // NPE -> 400
// after
if (tenant == null || tenant.isBlank()) throw new IllegalArgumentException("tenant required");
admin.sources().createSource(tenant, namespace, sourceName, fileName, config); Defensive patterns
Strategy: validation
Validate before calling
if (tenant == null || tenant.isBlank()) throw new IllegalArgumentException("tenant is required"); Type guard
boolean isValidTenant(String t) { return t != null && t.matches("[A-Za-z0-9_\\-.=]+"); } Try / catch
try { admin.sources().createSource(tenant, ns, name, file, cfg); } catch (PulsarAdminException e) { if (e.getStatusCode() == 400) { log.error("bad request: {}", e.getMessage()); } throw e; } Prevention
- Validate path parameters before building REST URLs
- Fail fast in scripts on empty env variables (set -u)
- Use client SDKs instead of hand-built URLs
- Create tenants as part of environment provisioning
When it happens
Trigger: POST /admin/v3/sources/{tenant}/{namespace}/{sourceName} with an empty/missing tenant path segment, or programmatic calls to Sinks/Sources REST API where the tenant variable was never set (null).
Common situations: Hand-built curl/REST calls with a malformed URL path; templated deployment scripts where a TENANT variable was empty; client SDK misuse passing null tenant.
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
- Namespace is not provided
- Source name is not provided
- cluster data is required
- %s %s cannot be admitted:- %s
- Source config is not provided
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/c6b4fcdd23794b7b.
Report an issue: GitHub.