apache/pulsar · error · IllegalArgumentException
%s Package is not provided
Error message
%s Package is not provided
What it means
Thrown as IllegalArgumentException when a source registration request does not include the code package: the source is neither built-in (isFunctionCodeBuiltin is false) nor supplied with a package file or PkgUrl. The worker wraps it and returns HTTP 400 with '<Source> Package is not provided'.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:168
boolean isPkgUrlProvided = isNotBlank(sourcePkgUrl);
File componentPackageFile = null;
try {
// validate parameters
try {
if (isPkgUrlProvided) {
componentPackageFile = getPackageFile(componentType, sourcePkgUrl);
functionDetails = validateUpdateRequestParams(tenant, namespace, sourceName,
sourceConfig, componentPackageFile);
} else {
if (uploadedInputStream != null) {
componentPackageFile = WorkerUtils.dumpToTmpFile(uploadedInputStream);
}
functionDetails = validateUpdateRequestParams(tenant, namespace, sourceName,
sourceConfig, componentPackageFile);
if (!isFunctionCodeBuiltin(functionDetails)
&& (componentPackageFile == null || fileDetail == null)) {
throw new IllegalArgumentException(
ComponentTypeUtils.toString(componentType) + " Package is not provided");
}
}
} catch (Exception e) {
log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)
.attr("namespace", namespace).attr("componentName", sourceName).exception(e)
.log("Invalid register request @ / / /");
throw new RestException(Response.Status.BAD_REQUEST, e.getMessage());
}
try {
worker().getFunctionRuntimeManager().getRuntimeFactory().doAdmissionChecks(functionDetails);
} catch (Exception e) {
log.error().attr("componentType", ComponentTypeUtils.toString(componentType)).attr("tenant", tenant)
.attr("namespace", namespace).attr("componentName", sourceName)View on GitHub (pinned to 820761864e)
Solutions
- Attach the package file to the multipart request (e.g. curl -F dataFile=@my-source.jar)
- Or set sourcePkgUrl in the source config to a reachable location (file://, http://, builtin://)
- Or use a builtin source by naming it from pulsar-admin sources builtins list
- Verify isNotBlank(sourcePkgUrl) or the uploaded stream is actually present before calling the API
Example fix
// before: no package supplied pulsar-admin sources create --tenant public --namespace default --name my-source --sourceConfigFile conf.yaml // -> 400 Source Package is not provided // after curl -X POST -F dataFile=@my-source.jar -F sourceConfig=@conf.yaml http://broker:8080/admin/v3/sources/public/default/my-source
Defensive patterns
Strategy: validation
Validate before calling
// validate before calling registerSource
boolean builtin = sourceConfig.getArchive() != null && sourceConfig.getArchive().startsWith("builtin://");
if (!builtin && (sourcePkgUrl == null || sourcePkgUrl.isBlank()) && (packageFile == null || !packageFile.exists())) {
throw new IllegalArgumentException("Non-builtin source requires sourcePkgUrl or an uploaded package file");
} Try / catch
try {
sources.registerSource(tenant, namespace, sourceName, sourcePkgUrl, null, sourceConfig, inputStream, fileDetail);
} catch (javax.ws.rs.BadRequestException e) {
String body = e.getResponse().readEntity(String.class);
if (body != null && body.contains("Package is not provided")) {
log.error("Attach the source archive or set sourcePkgUrl/builtin:// archive");
} else { throw e; }
} Prevention
- Always pass -F dataFile=@archive.jar (or equivalent multipart part) for custom sources
- Use builtin:// archives for builtins so no package upload is needed
- Validate the source config locally: custom archive must pair with a package or URL
- Add a pre-flight check in deploy tooling that the jar/zip path exists and is readable
When it happens
Trigger: POSTing a multipart registration for a non-builtin source with no sourcePkgUrl and no uploaded file part; registering a Java/Python source without attaching its archive.
Common situations: Forgetting --sourceConfigFile vs package in CLI invocation; curl request missing the -F file=@ upload; sourceConfig marks code as custom but architecture expects builtin (e.g. builtin:// source name omitted); UI form submitted without package upload.
Related errors
- Sink package is not provided
- <validation message from IllegalArgumentException>
- Tenant is not provided
- Namespace is not provided
- Function name is not provided
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/5830983d9fd2ad33.
Report an issue: GitHub.