{"record":{"id":"f4e41a0ef683fcc5","repo":"apache/pulsar","slug":"source-package-is-not-provided","errorCode":null,"errorMessage":"Source package is not provided","messagePattern":"Source package is not provided","errorType":"http","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java","lineNumber":740,"sourceCode":"                    throw new IllegalArgumentException(\"Built-in source is not available\");\n                }\n                connectorFunctionPackage = connector.getConnectorFunctionPackage();\n            }\n        }\n\n        boolean shouldCloseFunctionPackage = false;\n        try {\n            // if source is not builtin, attempt to extract classloader from package file if it exists\n            WorkerConfig workerConfig = worker().getWorkerConfig();\n            if (connectorFunctionPackage == null && sourcePackageFile != null) {\n                connectorFunctionPackage =\n                        new FunctionFilePackage(sourcePackageFile, workerConfig.getNarExtractionDirectory(),\n                                workerConfig.getEnableClassloadingOfExternalFiles(), ConnectorDefinition.class);\n                shouldCloseFunctionPackage = true;\n            }\n\n            if (connectorFunctionPackage == null) {\n                throw new IllegalArgumentException(\"Source package is not provided\");\n            }\n\n            SourceConfigUtils.ExtractedSourceDetails sourceDetails =\n                    SourceConfigUtils.validateAndExtractDetails(\n                            sourceConfig, connectorFunctionPackage,\n                            workerConfig.getValidateConnectorConfig());\n            return SourceConfigUtils.convert(sourceConfig, sourceDetails);\n        } finally {\n            if (shouldCloseFunctionPackage && connectorFunctionPackage instanceof AutoCloseable) {\n                try {\n                    ((AutoCloseable) connectorFunctionPackage).close();\n                } catch (Exception e) {\n                    log.error().exception(e).log(\"Failed to connector function file\");\n                }\n            }\n        }\n    }\n}","sourceCodeStart":722,"sourceCodeEnd":758,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java#L722-L758","documentation":"validateUpdateRequestParams throws this IllegalArgumentException when, after processing the sourcePackageFile upload and any builtin:// archive, no connector function package could be established. The update/register request effectively carried no usable source package.","triggerScenarios":"Calling registerSource/updateSource without providing a source package file (multipart data) and without a resolvable builtin:// archive, so connectorFunctionPackage remains null.","commonSituations":"Omitting the multipart file field in the REST upload; sending an empty package file; a builtin:// archive that silently failed to resolve earlier in the flow; client SDK misuse of updateSource with null data and null packageLocation.","solutions":["Always supply the source package (multipart file) when registering/updating a source that uses a custom package","Use a valid builtin:// archive name so the connector package resolves","Check the client code/SDK call so the package parameter is not null or empty","Inspect earlier log lines - a builtin resolution failure will have been logged before this error"],"exampleFix":"// before\nadmin.sources().updateSource(tn, ns, name, config, null); // no package\n// after\nadmin.sources().updateSource(tn, ns, name, config,\n    new UploadData(Files.readAllBytes(Paths.get(\"source.jar\")))); // provide package","handlingStrategy":"validation","validationCode":"boolean hasPackage = (sourcePackageFile != null && sourcePackageFile.getSize() > 0)\n    || (sourceConfig.getPackageLocation() != null && !sourceConfig.getPackageLocation().isBlank());\nif (!hasPackage) throw new IllegalArgumentException(\"Source package is required\");","typeGuard":"boolean hasUsablePackage(java.io.InputStream data, SourceConfig cfg) {\n    return (data != null) || (cfg != null && cfg.getPackageLocation() != null && !cfg.getPackageLocation().isBlank());\n}","tryCatchPattern":"try {\n    admin.sources().registerSource(tn, ns, name, cfg, packageData);\n} catch (PulsarAdminException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Source package is not provided\")) {\n        throw new IllegalStateException(\"Upload a source package file or use a builtin:// archive\", e);\n    }\n    throw e;\n}","preventionTips":["Always pass the multipart file when registering custom sources","Verify the upload stream is non-empty client-side before the call","Use builtin:// archives only when the connector is confirmed deployed","Review SDK method signatures - package params are separate from the config"],"tags":["pulsar-functions","package-upload","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}