apache/pulsar · error · IllegalArgumentException

${componentType} Package is not provided

Error message

${componentType} Package is not provided

What it means

updateSource requires a package whenever an existing builtin source is being updated with non-builtin code: if the stored package path starts with builtin:// and the new FunctionDetails is not builtin, a package must be supplied (uploadedInputStream/fileDetail or package file). Otherwise an IllegalArgumentException is raised and wrapped as 400 BAD_REQUEST with '<componentType> Package is not provided'.

Source

Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:343

        }

        FunctionDetails functionDetails;
        File componentPackageFile = null;
        try {

            // validate parameters
            try {
                componentPackageFile = getPackageFile(
                        componentType,
                        sourcePkgUrl,
                        existingComponent.getPackageLocation().getPackagePath(),
                        uploadedInputStream);
                functionDetails = validateUpdateRequestParams(tenant, namespace, sourceName,
                        mergedConfig, componentPackageFile);
                if (existingComponent.getPackageLocation().getPackagePath().startsWith(Utils.BUILTIN)
                        && !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 update 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

  1. Attach the new package: multipart-upload the jar/nar (uploadedInputStream) or set sourcePkgUrl to the package location
  2. If the updated code is still builtin, set the archive/class so isFunctionCodeBuiltin(functionDetails) is true (use builtin:// archive and a class contained in it)
  3. Check FunctionConfig/SourceConfig archive field: use 'builtin://<connector>' for builtin code or provide the package file for custom code

Example fix

// before: updating builtin source to custom class with no package
cfg.setClassName("com.custom.MySource"); // archive still builtin://kafka
// after: provide the custom package
cfg.setArchive("file:///path/to/my-source.nar"); // or upload via multipart
admin.sources().updateSource(tenant, ns, name, cfg, pkgUrl, null);
Defensive patterns

Strategy: validation

Validate before calling

SourceConfig existing = admin.sources().getSourceConfig(tenant, ns, name);
boolean wasBuiltin = existing.getArchive() != null && existing.getArchive().startsWith("builtin://");
boolean nowBuiltin = proposed.getArchive() != null && proposed.getArchive().startsWith("builtin://");
if (wasBuiltin && !nowBuiltin && pkgUrl == null && uploadStream == null) {
    throw new IllegalArgumentException("Non-builtin source update requires a package file or sourcePkgUrl");
}

Try / catch

try {
    admin.sources().updateSource(tenant, ns, name, cfg, pkgUrl, uploadStream);
} catch (PulsarAdminException e) {
    if (e.getStatusCode() == 400 && e.getMessage().contains("Package is not provided")) {
        log.error("Provide a jar/nar package when switching away from builtin code");
    } else { throw e; }
}

Prevention

When it happens

Trigger: Updating a source whose existing package location is builtin://... while the request neither is itself builtin nor provides componentPackageFile/fileDetail (no uploadedInputStream and no sourcePkgUrl download).

Common situations: Migrating a connector from a bundled builtin archive (built-in connectors under ./connectors) to a custom NAR/jar and forgetting to attach the new package file; switching the source class to a custom implementation while leaving the package unspecified.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/6f088081b90304dc. Report an issue: GitHub.