apache/pulsar · error · IllegalArgumentException

Source package is not provided

Error message

Source package is not provided

What it means

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.

Source

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

                    throw new IllegalArgumentException("Built-in source is not available");
                }
                connectorFunctionPackage = connector.getConnectorFunctionPackage();
            }
        }

        boolean shouldCloseFunctionPackage = false;
        try {
            // if source is not builtin, attempt to extract classloader from package file if it exists
            WorkerConfig workerConfig = worker().getWorkerConfig();
            if (connectorFunctionPackage == null && sourcePackageFile != null) {
                connectorFunctionPackage =
                        new FunctionFilePackage(sourcePackageFile, workerConfig.getNarExtractionDirectory(),
                                workerConfig.getEnableClassloadingOfExternalFiles(), ConnectorDefinition.class);
                shouldCloseFunctionPackage = true;
            }

            if (connectorFunctionPackage == null) {
                throw new IllegalArgumentException("Source package is not provided");
            }

            SourceConfigUtils.ExtractedSourceDetails sourceDetails =
                    SourceConfigUtils.validateAndExtractDetails(
                            sourceConfig, connectorFunctionPackage,
                            workerConfig.getValidateConnectorConfig());
            return SourceConfigUtils.convert(sourceConfig, sourceDetails);
        } finally {
            if (shouldCloseFunctionPackage && connectorFunctionPackage instanceof AutoCloseable) {
                try {
                    ((AutoCloseable) connectorFunctionPackage).close();
                } catch (Exception e) {
                    log.error().exception(e).log("Failed to connector function file");
                }
            }
        }
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Always supply the source package (multipart file) when registering/updating a source that uses a custom package
  2. Use a valid builtin:// archive name so the connector package resolves
  3. Check the client code/SDK call so the package parameter is not null or empty
  4. Inspect earlier log lines - a builtin resolution failure will have been logged before this error

Example fix

// before
admin.sources().updateSource(tn, ns, name, config, null); // no package
// after
admin.sources().updateSource(tn, ns, name, config,
    new UploadData(Files.readAllBytes(Paths.get("source.jar")))); // provide package
Defensive patterns

Strategy: validation

Validate before calling

boolean hasPackage = (sourcePackageFile != null && sourcePackageFile.getSize() > 0)
    || (sourceConfig.getPackageLocation() != null && !sourceConfig.getPackageLocation().isBlank());
if (!hasPackage) throw new IllegalArgumentException("Source package is required");

Type guard

boolean hasUsablePackage(java.io.InputStream data, SourceConfig cfg) {
    return (data != null) || (cfg != null && cfg.getPackageLocation() != null && !cfg.getPackageLocation().isBlank());
}

Try / catch

try {
    admin.sources().registerSource(tn, ns, name, cfg, packageData);
} catch (PulsarAdminException e) {
    if (e.getMessage() != null && e.getMessage().contains("Source package is not provided")) {
        throw new IllegalStateException("Upload a source package file or use a builtin:// archive", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling registerSource/updateSource without providing a source package file (multipart data) and without a resolvable builtin:// archive, so connectorFunctionPackage remains null.

Common situations: 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.

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


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