{"record":{"id":"a52f9bc1d464634b","repo":"apache/pulsar","slug":"you-must-specify-a-name-for-the-sink","errorCode":null,"errorMessage":"You must specify a name for the sink","messagePattern":"You must specify a name for the sink","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java","lineNumber":690,"sourceCode":"        protected String tenant;\n\n        @Option(names = \"--namespace\", description = \"The sink's namespace\")\n        protected String namespace;\n\n        @Option(names = \"--name\", description = \"The sink's name\")\n        protected String sinkName;\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 == sinkName) {\n                throw new RuntimeException(\n                        \"You must specify a name for the sink\");\n            }\n        }\n    }\n\n    @Command(description = \"Stops a Pulsar IO sink connector\")\n    protected class DeleteSink extends SinkCommand {\n\n        @Override\n        void runCmd() throws Exception {\n            getAdmin().sinks().deleteSink(tenant, namespace, sinkName);\n            print(\"Deleted successfully\");\n        }\n    }\n\n    @Command(description = \"Gets the information about a Pulsar IO sink connector\")\n    protected class GetSink extends SinkCommand {\n","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java#L672-L708","documentation":"After applying tenant/namespace defaults, the sink command still requires an explicit sink name; if --name was not provided a RuntimeException is thrown, since every sink needs a unique identifying name.","triggerScenarios":"Running `pulsar-admin sinks create/update/delete/restart` (any subcommand needing the name) without the `--name` flag and without a name in the provided config.","commonSituations":"Omitting --name assuming it is derived from the NAR filename or config; copy-pasted command truncated the name argument.","solutions":["Add --name <sink-name> to the command","If using --sink-config-file, add the \"name\" field to the config JSON","Verify the flag name is `--name`, not a typo like `--sinkname`"],"exampleFix":"// before\npulsar-admin sinks create --archive ./s.nar --inputs i\n// after\npulsar-admin sinks create --archive ./s.nar --inputs i --name my-sink","handlingStrategy":"validation","validationCode":"if (!args.includes('--name') && !configHasField('name')) {\n  throw new Error('Sink command requires --name');\n}","typeGuard":"const hasName = (c) => typeof c?.name === 'string' && c.name.length > 0;","tryCatchPattern":"try {\n  // run sinks command\n} catch (e) {\n  if (e.message.includes('must specify a name for the sink')) { /* add --name */ }\n  throw e;\n}","preventionTips":["Always pass --name on sink subcommands","Include \"name\" in sink-config JSON files","Script sink deployments with a name template"],"tags":["cli","pulsar-io","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"}