apache/pulsar · error · RestException
Tenant is not provided
Error message
Tenant is not provided
What it means
registerSink in SinksImpl validates its request parameters up front and throws a 400 Bad Request RestException when the tenant path/query parameter is null. Sink registration is namespaced under tenant/namespace, so a tenant must always be supplied. This fail-fast check happens before any authorization or cluster lookup.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:91
super(workerServiceSupplier, FunctionDetails.ComponentType.SINK);
}
@Override
public void registerSink(final String tenant,
final String namespace,
final String sinkName,
final InputStream uploadedInputStream,
final FormDataContentDisposition fileDetail,
final String sinkPkgUrl,
final SinkConfig sinkConfig,
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 (sinkName == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Sink name is not provided");
}
if (sinkConfig == null) {
throw new RestException(Response.Status.BAD_REQUEST, "Sink config is not provided");
}
throwRestExceptionIfUnauthorizedForNamespace(tenant, namespace, sinkName, "register", authParams);
try {
// Check tenant exists
worker().getBrokerAdmin().tenants().getTenantInfo(tenant);
String qualifiedNamespace = tenant + "/" + namespace;View on GitHub (pinned to 820761864e)
Solutions
- Include the tenant in the request URL: PUT /admin/v3/sinks/{tenant}/{namespace}/{sinkName} with all three segments populated.
- Check the client code or script variable that supplies tenant and ensure it is a non-empty string before the call.
- If invoking SinksImpl directly, guard the tenant argument for null/blank before calling registerSink.
Example fix
// before
String url = String.format("/admin/v3/sinks/%s/%s/%s", tenant, namespace, sinkName); // tenant == null
// after
if (tenant == null || tenant.isBlank()) {
throw new IllegalArgumentException("tenant is required");
}
String url = String.format("/admin/v3/sinks/%s/%s/%s", tenant, namespace, sinkName); Defensive patterns
Strategy: validation
Validate before calling
if (tenant == null || tenant.isBlank()) {
throw new IllegalArgumentException("tenant must be provided");
} Type guard
boolean hasTenant(String tenant) {
return tenant != null && !tenant.isBlank();
} Try / catch
try {
sinks.registerSink(tenant, ns, name, cfg, null, null, null, authParams);
} catch (RestException e) {
if (e.getResponse().getStatus() == 400 && "Tenant is not provided".equals(e.getMessage())) {
// supply tenant and re-issue the request
} else { throw e; }
} Prevention
- Build REST URLs from a single helper that asserts all path segments are non-blank
- Fail fast in scripts on empty environment variables feeding tenant/namespace
- Keep tenant/namespace/name in one config record validated at startup
When it happens
Trigger: Calling the sink registration REST endpoint (registerSink) with tenant=null: omitting the tenant path parameter in the URL, or passing a null tenant when invoking SinksImpl programmatically.
Common situations: Building the REST URL with a templating helper that drops empty path segments; CLI/script variable for tenant left empty; client SDK binding that maps missing query params to null instead of rejecting them.
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
- Sink name is not provided
- Sink config is not provided
- <validation message from IllegalArgumentException>
- Path key doesn't match key in json
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/f59e543abf9a5649.
Report an issue: GitHub.