apache/pulsar · error · ParameterException

Source archive not specified

Error message

Source archive not specified

What it means

validateSourceConfigs requires sourceConfig.archive to be set before a source can be deployed; the archive identifies the NAR/package containing the source implementation. A blank archive yields this ParameterException.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java:529

            // check if source configs are valid
            validateSourceConfigs(sourceConfig);
        }

        protected Map<String, Object> parseConfigs(String str) throws JsonProcessingException {
            ObjectMapper mapper = ObjectMapperFactory.getMapper().getObjectMapper();
            TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {};

            return mapper.readValue(str, typeRef);
        }

        protected BatchSourceConfig parseBatchSourceConfigs(String str) {
            return new Gson().fromJson(str, BatchSourceConfig.class);
        }

        protected void validateSourceConfigs(SourceConfig sourceConfig) {
            if (isBlank(sourceConfig.getArchive())) {
                throw new ParameterException("Source archive not specified");
            }
            org.apache.pulsar.common.functions.Utils.inferMissingArguments(sourceConfig);
            if (!Utils.isFunctionPackageUrlSupported(sourceConfig.getArchive())
                    && !sourceConfig.getArchive().startsWith(Utils.BUILTIN)) {
                if (!new File(sourceConfig.getArchive()).exists()) {
                    throw new IllegalArgumentException(String.format("Source Archive %s does not exist",
                            sourceConfig.getArchive()));
                }
            }
            if (isBlank(sourceConfig.getName())) {
                throw new IllegalArgumentException("Source name not specified");
            }

            if (sourceConfig.getBatchSourceConfig() != null) {
                validateBatchSourceConfigs(sourceConfig.getBatchSourceConfig());
            }
        }

View on GitHub (pinned to 820761864e)

Solutions

  1. Add --archive /path/to/source.nar (or a package:// URL)
  2. Or add --source-type <name> to use a built-in connector
  3. Include the archive field in the source config JSON file if using one

Example fix

// before
pulsar-admin sources create --tenant t --namespace n --name s --destination-topic-name o
// after
pulsar-admin sources create --tenant t --namespace n --name s --destination-topic-name o --source-type kafka
Defensive patterns

Strategy: validation

Validate before calling

if (!args.includes('--archive') && !args.includes('--source-type')) {
  throw new Error('Source requires --archive or --source-type');
}

Type guard

const sourceReady = (c) => Boolean(c && (c.archive || c.sourceType));

Try / catch

try {
  // run sources create
} catch (e) {
  if (e.message.includes('Source archive not specified')) { /* add --archive/--source-type */ }
  throw e;
}

Prevention

When it happens

Trigger: Running `pulsar-admin sources create` with neither --archive nor --source-type (the latter would have been converted to builtin://...), so the SourceConfig has no archive.

Common situations: Forgetting the archive flag; a --source-config-file JSON lacking the archive field; typo in the flag so it is silently ignored.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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