apache/pulsar · warning · RestException
Source name is not provided
Error message
Source name is not provided
What it means
Register-source request validation in SourcesImpl.registerSource: required fields of the registration request are missing (tenant checked first, source name among them) or the worker is unavailable, so the source registration REST call is rejected; the missing request field is the faulty input.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:96
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;
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", sourceName)View on GitHub (pinned to 820761864e)
Solutions
- Set the name field in the source config
Example fix
// before
admin.sources().createSource(tenant, namespace, null, fileName, config);
// after
String sourceName = cfg.getString("source.name");
Validate.notNull(sourceName, "sourceName is required");
admin.sources().createSource(tenant, namespace, sourceName, fileName, config); Defensive patterns
Strategy: validation
Validate before calling
if (sourceName == null || sourceName.isBlank()) throw new IllegalArgumentException("source name is required"); Type guard
boolean isValidComponentName(String n) { return n != null && n.matches("[A-Za-z0-9_\\-.=]+"); } Try / catch
try { admin.sources().createSource(tenant, ns, name, file, cfg); } catch (PulsarAdminException e) { if (e.getStatusCode() == 400) { log.warn("invalid params: {}", e.getMessage()); } throw e; } Prevention
- Require component names in deployment tooling (no silent defaults)
- Validate names against Pulsar's allowed character set
- Avoid trailing-slash URLs when building requests manually
- Generate names deterministically in bulk provisioning loops
When it happens
Trigger: POST /admin/v3/sources/{tenant}/{namespace}/{sourceName} with an empty name segment, or programmatic calls passing null sourceName after the tenant/namespace checks passed.
Common situations: URLs with a trailing slash and no component name; generated clients leaving the name argument null; bulk provisioning loops where the name variable was never assigned.
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
- 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/d4ca68356c4d2c04.
Report an issue: GitHub.