apache/pulsar · error · IllegalArgumentException
Function package is not provided
Error message
Function package is not provided
What it means
IllegalArgumentException thrown by validateUpdateRequestParams when the function runtime is JAVA but no function package can be resolved: the config's jar is not a builtin reference (so functionPackage stayed null) and no uploaded package file (componentPackageFile) was supplied. Java functions require a code package so the worker can validate and load the function class.
Source
Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:822
if (function == null) {
throw new IllegalArgumentException(String.format("No Function %s found", archive));
}
functionPackage = function.getFunctionPackage();
}
}
boolean shouldCloseFunctionPackage = false;
try {
if (functionConfig.getRuntime() == FunctionConfig.Runtime.JAVA) {
// if function is not builtin, attempt to extract classloader from package file if it exists
if (functionPackage == null && componentPackageFile != null) {
functionPackage =
new FunctionFilePackage(componentPackageFile, workerConfig.getNarExtractionDirectory(),
workerConfig.getEnableClassloadingOfExternalFiles(), FunctionDefinition.class);
shouldCloseFunctionPackage = true;
}
if (functionPackage == null) {
throw new IllegalArgumentException("Function package is not provided");
}
FunctionConfigUtils.ExtractedFunctionDetails functionDetails = FunctionConfigUtils.validateJavaFunction(
functionConfig, functionPackage);
return FunctionConfigUtils.convert(functionConfig, functionDetails);
} else {
FunctionConfigUtils.validateNonJavaFunction(functionConfig);
return FunctionConfigUtils.convert(functionConfig);
}
} finally {
if (shouldCloseFunctionPackage && functionPackage instanceof AutoCloseable) {
try {
((AutoCloseable) functionPackage).close();
} catch (Exception e) {
log.error().exception(e).log("Failed to close function file");
}
}
}View on GitHub (pinned to 820761864e)
Solutions
- Attach the function jar in the multipart upload (correct form field name) or provide a reachable functionPkgUrl (http(s)://, file:// on the worker, or builtin://).
- If the code is a built-in connector, prefix the jar with builtin:// so validation resolves it via FunctionsManager.
- Verify the package URL is accessible from the worker host, not just the client, at registration time.
Example fix
// before registerFunction(tenant, ns, name, null /* no file */, null, "http://internal/repo/fn.jar", config); // after registerFunction(tenant, ns, name, jarInputStream, fileDetail, null, config); // upload jar directly
Defensive patterns
Strategy: validation
Validate before calling
boolean hasPackage = (jar != null && jar.startsWith("builtin://"))
|| uploadedInputStream != null
|| (functionPkgUrl != null && isUrlReachableFromWorker(functionPkgUrl));
if (!hasPackage) throw new IllegalArgumentException("provide builtin:// jar, uploaded file, or reachable pkgUrl"); Prevention
- Always attach the jar multipart part (or a reachable package URL) when registering Java functions.
- Confirm package URLs are resolvable from the worker host, not only the client.
- For built-in code, always prefix the jar value with builtin://.
When it happens
Trigger: registerFunction/updateFunction called with a Java-runtime config, no builtin:// jar, functionPkgUrl not resolvable to a local file, and no multipart file upload; e.g. passing only a package URL the worker cannot fetch, or omitting the file part in the multipart form.
Common situations: Client sends a fileUpload field name the endpoint doesn't expect, so the InputStream binds null; using pkgUrl with a scheme the worker can't fetch at validation time; registering a Java function through the V2 JSON API without attaching the jar; automation that assumes builtin but config still points to a custom jar.
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
- Corrupt Function MetaData
- No Function %s found
- e.getMessage()
- Cannot terminate non-persistent topic: ${segmentTopic}
- <validation message from IllegalArgumentException>
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/523a249ff329ad59.
Report an issue: GitHub.