apache/pulsar · error · ParameterException

Invalid source type '%s' -- Available sources are: %s

Error message

Invalid source type '%s' -- Available sources are: %s

What it means

Thrown by validateSourceType when the --source-type value given to the CLI is not among the built-in connector types listed by the broker's /connectors endpoint. When sourceType is set, the CLI resolves it to builtin://<type> and validates it against available connectors fetched via the admin API. Note the failure is wrapped in a ParameterException, so it aborts argument processing.

Source

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

        }

        protected void validateBatchSourceConfigs(BatchSourceConfig batchSourceConfig) {
            if (isBlank(batchSourceConfig.getDiscoveryTriggererClassName())) {
                throw new IllegalArgumentException("Discovery Triggerer not specified");
            }
        }

        protected String validateSourceType(String sourceType) throws IOException {
            Set<String> availableSources;
            try {
                availableSources = getAdmin().sources().getBuiltInSources().stream()
                        .map(ConnectorDefinition::getName).collect(Collectors.toSet());
            } catch (PulsarAdminException e) {
                throw new IOException(e);
            }

            if (!availableSources.contains(sourceType)) {
                throw new ParameterException(
                        "Invalid source type '" + sourceType + "' -- Available sources are: " + availableSources);
            }

            // Source type is a valid built-in connector type
            return "builtin://" + sourceType;
        }
    }

    /**
     * Function level command.
     */
    @Getter
    abstract class SourceCommand extends BaseCommand {
        @Option(names = "--tenant", description = "The source's tenant")
        protected String tenant;

        @Option(names = "--namespace", description = "The source's namespace")
        protected String namespace;

View on GitHub (pinned to 820761864e)

Solutions

  1. Run `pulsar-admin sources available-sources` (or check the /admin/v3/functions/connectors endpoint) and use an exact name from the list
  2. Deploy the connector NAR into the broker's connectors directory and restart
  3. Fix the spelling/case of the --source-type value
  4. Drop --source-type and use --archive with an explicit jar/nar path instead

Example fix

// before
pulsar-admin sources create --source-type kafaka ...
// after
pulsar-admin sources create --source-type kafka ...
Defensive patterns

Strategy: validation

Validate before calling

Set<String> available = admin.connectors().getConnectors()
        .stream().map(ConnectorDefinition::getName).collect(Collectors.toSet());
if (!available.contains(sourceType)) {
    throw new IllegalArgumentException("Unknown source type: " + sourceType + ", available: " + available);
}

Type guard

boolean isBuiltinSourceType(String type, Set<String> available) {
    return type != null && available.contains(type);
}

Try / catch

try {
    admin.sources().createSource(sourceConfig);
} catch (ParameterException | IOException e) {
    System.err.println("List valid types with: pulsar-admin sources available-sources");
}

Prevention

When it happens

Trigger: Running a sources command with --source-type set to a name not present in the broker's connector registry (e.g. the connectors directory is empty, the connector NAR is not deployed, or the type name is misspelled).

Common situations: Typo in connector name, broker started without the connectors/ directory populated, using a connector name valid on one cluster but not another, or the function worker's connector endpoint returning an empty list.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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