{"record":{"id":"5830983d9fd2ad33","repo":"apache/pulsar","slug":"s-package-is-not-provided-583098","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/SourcesImpl.java","lineNumber":168,"sourceCode":"        boolean isPkgUrlProvided = isNotBlank(sourcePkgUrl);\n        File componentPackageFile = null;\n        try {\n\n            // validate parameters\n            try {\n                if (isPkgUrlProvided) {\n                    componentPackageFile = getPackageFile(componentType, sourcePkgUrl);\n                    functionDetails = validateUpdateRequestParams(tenant, namespace, sourceName,\n                            sourceConfig, componentPackageFile);\n                } else {\n                    if (uploadedInputStream != null) {\n                        componentPackageFile = WorkerUtils.dumpToTmpFile(uploadedInputStream);\n                    }\n                    functionDetails = validateUpdateRequestParams(tenant, namespace, sourceName,\n                            sourceConfig, componentPackageFile);\n                    if (!isFunctionCodeBuiltin(functionDetails)\n                            && (componentPackageFile == null || fileDetail == null)) {\n                        throw new IllegalArgumentException(\n                                ComponentTypeUtils.toString(componentType) + \" 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\", sourceName).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\", sourceName)","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java#L150-L186","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: no package supplied\npulsar-admin sources create --tenant public --namespace default --name my-source --sourceConfigFile conf.yaml // -> 400 Source Package is not provided\n// after\ncurl -X POST -F dataFile=@my-source.jar -F sourceConfig=@conf.yaml http://broker:8080/admin/v3/sources/public/default/my-source","handlingStrategy":"validation","validationCode":"// validate before calling registerSource\nboolean builtin = sourceConfig.getArchive() != null && sourceConfig.getArchive().startsWith(\"builtin://\");\nif (!builtin && (sourcePkgUrl == null || sourcePkgUrl.isBlank()) && (packageFile == null || !packageFile.exists())) {\n    throw new IllegalArgumentException(\"Non-builtin source requires sourcePkgUrl or an uploaded package file\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    sources.registerSource(tenant, namespace, sourceName, sourcePkgUrl, null, sourceConfig, inputStream, fileDetail);\n} catch (javax.ws.rs.BadRequestException e) {\n    String body = e.getResponse().readEntity(String.class);\n    if (body != null && body.contains(\"Package is not provided\")) {\n        log.error(\"Attach the source archive or set sourcePkgUrl/builtin:// archive\");\n    } else { throw e; }\n}","preventionTips":["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"],"tags":["missing-package","validation","rest-api","pulsar-functions"],"backgroundTag":"missing-package-artifact","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"}