apache/pulsar · error · RestException
Sink name is not provided
Error message
Sink name is not provided
What it means
registerSink in SinksImpl throws a 400 Bad Request RestException when sinkName is null. The sink name is the identity of the component within tenant/namespace, required to build the function metadata record. This is the third in the chain of mandatory-parameter checks, evaluated after tenant and namespace.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:97
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;
List<String> namespaces = worker().getBrokerAdmin().namespaces().getNamespaces(tenant);
if (namespaces != null && !namespaces.contains(qualifiedNamespace)) {
String qualifiedNamespaceWithCluster = String.format("%s/%s/%s", tenant,
worker().getWorkerConfig().getPulsarFunctionsCluster(), namespace);
if (namespaces != null && !namespaces.contains(qualifiedNamespaceWithCluster)) {
log.error().attr("tenant", tenant).attr("namespace", namespace).attr("componentName", sinkName)View on GitHub (pinned to 820761864e)
Solutions
- Provide the sinkName path segment in the REST URL and/or pass a non-null name to registerSink.
- If the name should come from SinkConfig, set sinkConfig.setName(...) before submitting and pass that config.
- Validate all of tenant/namespace/sinkName client-side before calling the API to get one clean error.
Example fix
// before
sinks.registerSink(tenant, namespace, null, sinkConfig, ...);
// after
String name = sinkConfig.getName();
if (name == null || name.isBlank()) {
throw new IllegalArgumentException("sink name is required");
}
sinks.registerSink(tenant, namespace, name, sinkConfig, ...); Defensive patterns
Strategy: validation
Validate before calling
String name = sinkConfig != null ? sinkConfig.getName() : null;
if (name == null || name.isBlank()) {
throw new IllegalArgumentException("sink name must be provided");
} Type guard
boolean hasSinkName(String sinkName) {
return sinkName != null && !sinkName.isBlank();
} Try / catch
try {
sinks.registerSink(tenant, ns, name, cfg, null, null, null, authParams);
} catch (RestException e) {
if (e.getResponse().getStatus() == 400 && "Sink name is not provided".equals(e.getMessage())) {
// derive the name from config or CLI args and retry
} else { throw e; }
} Prevention
- Set the name in SinkConfig and pass it explicitly rather than relying on defaults
- Validate tenant/namespace/name together before any REST call
- Make CLI tools fail on empty derived names instead of sending null
When it happens
Trigger: Calling the sink registration endpoint with sinkName=null: omitted sinkName path segment, null argument to SinksImpl.registerSink, or a name that was never set in the SinkConfig and not passed separately.
Common situations: CLI tools deriving the name from a file name that is empty; SDK calls that expect the name to come from SinkConfig but pass null explicitly; copy-pasted request code where the name placeholder was never filled.
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
- Tenant is not provided
- Namespace 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/394ab79cfdfe3723.
Report an issue: GitHub.