{"record":{"id":"2b5bcc4356dd9ad7","repo":"apache/pulsar","slug":"s-package-is-not-provided","errorCode":null,"errorMessage":"%s Package is not provided","messagePattern":"(.+?) Package is not provided","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java","lineNumber":169,"sourceCode":"        FunctionDetails functionDetails;\n        File componentPackageFile = null;\n        try {\n\n            // validate parameters\n            try {\n                if (isNotBlank(functionPkgUrl)) {\n                    componentPackageFile = getPackageFile(componentType, functionPkgUrl);\n                    functionDetails = validateUpdateRequestParams(tenant, namespace, functionName,\n                            functionConfig, componentPackageFile);\n                } else {\n                    if (uploadedInputStream != null) {\n                        componentPackageFile = WorkerUtils.dumpToTmpFile(uploadedInputStream);\n                    }\n                    functionDetails = validateUpdateRequestParams(tenant, namespace, functionName,\n                            functionConfig, componentPackageFile);\n                    if (!isFunctionCodeBuiltin(functionDetails)\n                            && (componentPackageFile == null || fileDetail == null)) {\n                        throw new IllegalArgumentException(ComponentTypeUtils.toString(componentType)\n                                + \" Package is not provided\");\n                    }\n                }\n            } catch (Exception e) {\n                log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                        .attr(\"namespace\", namespace).attr(\"componentName\", functionName).exception(e)\n\n                        .log(\"Invalid register request @ / / /\");\n                throw new RestException(Response.Status.BAD_REQUEST, e.getMessage());\n            }\n\n            try {\n                worker().getFunctionRuntimeManager().getRuntimeFactory().doAdmissionChecks(functionDetails);\n            } catch (Exception e) {\n                log.error().attr(\"componentType\", ComponentTypeUtils.toString(componentType)).attr(\"tenant\", tenant)\n\n                        .attr(\"namespace\", namespace).attr(\"componentName\", functionName).exception(e)","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java#L151-L187","documentation":"When registering a function whose code is not a built-in archive, the request must carry the component package (uploaded jar/zip via the file upload field). If isFunctionCodeBuiltin is false but componentPackageFile or the uploaded file detail is null, registerFunction throws IllegalArgumentException '<ComponentType> Package is not provided' (surfaced as HTTP 400). Built-in (builtin://) packages are exempt.","triggerScenarios":"Registering with a normal (non-builtin) code URL but omitting the multipart file upload / --jar file; sending functionConfig without the package input stream.","commonSituations":"CLI invocation missing --jar; REST call without the multipart 'data' part; using builtin:// incorrectly removed while no file uploaded; scripts passing a URL as if the worker could fetch it when this API requires the upload.","solutions":["Attach the package file: 'pulsar-admin functions create --jar /path/to/function.jar ...'","For REST, include the jar as the multipart upload (data field) alongside the functionConfig","Alternatively use 'builtin://<name>' for a valid installed built-in archive so no upload is required"],"exampleFix":"// before\npulsar-admin functions create --tenant public --namespace default --name fn --classname org.foo.Fn\n// after\npulsar-admin functions create --tenant public --namespace default --name fn --classname org.foo.Fn --jar /path/to/function.jar","handlingStrategy":"validation","validationCode":"boolean builtin = cfg.getArchive() != null && cfg.getArchive().startsWith(\"builtin://\");\njava.io.File jar = new java.io.File(jarPath);\nif (!builtin && !(jar.exists() && jar.length() > 0)) {\n    throw new IllegalArgumentException(\"--jar package required for non-builtin functions\");\n}","typeGuard":"boolean packageProvided(FunctionConfig cfg, java.io.File jar) {\n    boolean builtin = cfg != null && cfg.getArchive() != null && cfg.getArchive().startsWith(\"builtin://\");\n    return builtin || (jar != null && jar.isFile() && jar.length() > 0);\n}","tryCatchPattern":"try { admin.functions().createFunction(tenant, ns, name, pkgUrl, cfg, jarPath); }\ncatch (PulsarAdminException e) {\n    if (e.getStatusCode() == 400 && String.valueOf(e.getMessage()).contains(\"Package is not provided\")) {\n        // attach the jar upload and retry\n    }\n}","preventionTips":["Always pass --jar for non-builtin functions in CLI scripts","Verify the file exists and is non-empty before invoking the API","Use builtin:// only with names confirmed installed on the worker"],"tags":["pulsar-functions","package-upload","rest-api"],"backgroundTag":"missing-package","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}