{"record":{"id":"8092897c759fbe8f","repo":"apache/pulsar","slug":"you-must-specify-a-name-for-the-source","errorCode":null,"errorMessage":"You must specify a name for the source","messagePattern":"You must specify a name for the source","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java","lineNumber":597,"sourceCode":"        protected String tenant;\n\n        @Option(names = \"--namespace\", description = \"The source's namespace\")\n        protected String namespace;\n\n        @Option(names = \"--name\", description = \"The source's name\")\n        protected String sourceName;\n\n        @Override\n        void processArguments() throws Exception {\n            super.processArguments();\n            if (tenant == null) {\n                tenant = PUBLIC_TENANT;\n            }\n            if (namespace == null) {\n                namespace = DEFAULT_NAMESPACE;\n            }\n            if (null == sourceName) {\n                throw new RuntimeException(\n                            \"You must specify a name for the source\");\n            }\n        }\n    }\n\n    @Command(description = \"Stops a Pulsar IO source connector\")\n    protected class DeleteSource extends SourceCommand {\n\n        @Override\n        void runCmd() throws Exception {\n            getAdmin().sources().deleteSource(tenant, namespace, sourceName);\n            print(\"Delete source successfully\");\n        }\n    }\n\n    @Command(description = \"Gets the information about a Pulsar IO source connector\")\n    protected class GetSource extends SourceCommand {\n","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java#L579-L615","documentation":"Thrown by processArguments of the source command when no source name was provided at all. Unlike validateSourceConfigs (which checks the config object after defaults are inferred), this is the earlier check on the parsed CLI argument: a name is mandatory for the operation to identify the source. It surfaces as a RuntimeException from the command's argument processing.","triggerScenarios":"Invoking `pulsar-admin sources create/update/delete/get/status/localrun` without --name (or the positional name argument), so sourceName is null after argument parsing.","commonSituations":"Forgetting the --name flag, CI scripts with empty variables, copy-pasting commands and deleting the name, or confusing --source-config-file (which may lack a name) with providing --name.","solutions":["Pass --name <source-name> on the command line","Ensure the scripted variable supplying the name is non-empty","Include a name in the source config file and verify it is loaded"],"exampleFix":"// before\npulsar-admin sources delete --tenant public --namespace default\n// after\npulsar-admin sources delete --name my-source --tenant public --namespace default","handlingStrategy":"validation","validationCode":"if (sourceName == null || sourceName.isBlank()) {\n    throw new IllegalArgumentException(\"--name is required\");\n}","typeGuard":"boolean hasName(String name) {\n    return name != null && !name.trim().isEmpty();\n}","tryCatchPattern":"try {\n    admin.sources().updateSource(config);\n} catch (RuntimeException e) {\n    System.err.println(\"Supply --name: \" + e.getMessage());\n}","preventionTips":["Treat --name as mandatory in all sources subcommands","Fail fast in wrapper scripts when the name variable is empty","Keep source names consistent between create and update commands"],"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"}