{"record":{"id":"499df056be168e54","repo":"apache/pulsar","slug":"source-name-not-specified","errorCode":null,"errorMessage":"Source name not specified","messagePattern":"Source name not specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java","lineNumber":540,"sourceCode":"\n        protected BatchSourceConfig parseBatchSourceConfigs(String str) {\n            return new Gson().fromJson(str, BatchSourceConfig.class);\n        }\n\n        protected void validateSourceConfigs(SourceConfig sourceConfig) {\n            if (isBlank(sourceConfig.getArchive())) {\n                throw new ParameterException(\"Source archive not specified\");\n            }\n            org.apache.pulsar.common.functions.Utils.inferMissingArguments(sourceConfig);\n            if (!Utils.isFunctionPackageUrlSupported(sourceConfig.getArchive())\n                    && !sourceConfig.getArchive().startsWith(Utils.BUILTIN)) {\n                if (!new File(sourceConfig.getArchive()).exists()) {\n                    throw new IllegalArgumentException(String.format(\"Source Archive %s does not exist\",\n                            sourceConfig.getArchive()));\n                }\n            }\n            if (isBlank(sourceConfig.getName())) {\n                throw new IllegalArgumentException(\"Source name not specified\");\n            }\n\n            if (sourceConfig.getBatchSourceConfig() != null) {\n                validateBatchSourceConfigs(sourceConfig.getBatchSourceConfig());\n            }\n        }\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());","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java#L522-L558","documentation":"Thrown by validateSourceConfigs after inferMissingArguments fills defaults: the SourceConfig has no name set. Every Pulsar IO source requires a unique name within its tenant/namespace so the broker can manage it. The CLI rejects the request before any server call.","triggerScenarios":"Running `pulsar-admin sources create/update/localrun` without --name and without a name in the config file passed via --source-config-file.","commonSituations":"Forgetting the --name flag on create, a source-config YAML/JSON missing the 'name' key, or scripting the CLI where an empty variable is expanded to nothing.","solutions":["Add --name <source-name> to the command","Add a name field to the source config file","Check your script/CI variable that supplies the name is not empty"],"exampleFix":"// before\npulsar-admin sources create --archive ./my-source.nar --tenant public --namespace default\n// after\npulsar-admin sources create --name my-source --archive ./my-source.nar --tenant public --namespace default","handlingStrategy":"validation","validationCode":"if (sourceConfig.getName() == null || sourceConfig.getName().isBlank()) {\n    throw new IllegalArgumentException(\"Source name must be set before calling the CLI\");\n}","typeGuard":"boolean hasSourceName(SourceConfig cfg) {\n    return cfg.getName() != null && !cfg.getName().trim().isEmpty();\n}","tryCatchPattern":"try {\n    admin.sources().createSource(sourceConfig);\n} catch (IllegalArgumentException e) {\n    System.err.println(\"Set --name or a name in the config file\");\n}","preventionTips":["Always pass --name explicitly, even when a config file is used","Verify config YAML/JSON contains the name key","Validate scripted variables before expanding them into CLI flags"],"tags":["pulsar-admin","cli","io-connector","missing-argument"],"backgroundTag":"missing-required-argument","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"}