{"record":{"id":"6daa17151e8226dd","repo":"apache/pulsar","slug":"invalid-source-type-s-available-sources-are","errorCode":null,"errorMessage":"Invalid source type '%s' -- Available sources are: %s","messagePattern":"Invalid source type '(.+?)' -- Available sources are: (.+?)","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java","lineNumber":564,"sourceCode":"        }\n\n        protected void validateBatchSourceConfigs(BatchSourceConfig batchSourceConfig) {\n            if (isBlank(batchSourceConfig.getDiscoveryTriggererClassName())) {\n                throw new IllegalArgumentException(\"Discovery Triggerer not specified\");\n            }\n        }\n\n        protected String validateSourceType(String sourceType) throws IOException {\n            Set<String> availableSources;\n            try {\n                availableSources = getAdmin().sources().getBuiltInSources().stream()\n                        .map(ConnectorDefinition::getName).collect(Collectors.toSet());\n            } catch (PulsarAdminException e) {\n                throw new IOException(e);\n            }\n\n            if (!availableSources.contains(sourceType)) {\n                throw new ParameterException(\n                        \"Invalid source type '\" + sourceType + \"' -- Available sources are: \" + availableSources);\n            }\n\n            // Source type is a valid built-in connector type\n            return \"builtin://\" + sourceType;\n        }\n    }\n\n    /**\n     * Function level command.\n     */\n    @Getter\n    abstract class SourceCommand extends BaseCommand {\n        @Option(names = \"--tenant\", description = \"The source's tenant\")\n        protected String tenant;\n\n        @Option(names = \"--namespace\", description = \"The source's namespace\")\n        protected String namespace;","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java#L546-L582","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Run `pulsar-admin sources available-sources` (or check the /admin/v3/functions/connectors endpoint) and use an exact name from the list","Deploy the connector NAR into the broker's connectors directory and restart","Fix the spelling/case of the --source-type value","Drop --source-type and use --archive with an explicit jar/nar path instead"],"exampleFix":"// before\npulsar-admin sources create --source-type kafaka ...\n// after\npulsar-admin sources create --source-type kafka ...","handlingStrategy":"validation","validationCode":"Set<String> available = admin.connectors().getConnectors()\n        .stream().map(ConnectorDefinition::getName).collect(Collectors.toSet());\nif (!available.contains(sourceType)) {\n    throw new IllegalArgumentException(\"Unknown source type: \" + sourceType + \", available: \" + available);\n}","typeGuard":"boolean isBuiltinSourceType(String type, Set<String> available) {\n    return type != null && available.contains(type);\n}","tryCatchPattern":"try {\n    admin.sources().createSource(sourceConfig);\n} catch (ParameterException | IOException e) {\n    System.err.println(\"List valid types with: pulsar-admin sources available-sources\");\n}","preventionTips":["Run available-sources first and copy the exact name","Remember the broker's connector registry is cluster-specific","Prefer --archive with explicit paths when portability matters"],"tags":["pulsar-admin","cli","io-connector","invalid-argument"],"backgroundTag":"invalid-enum-value","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"}