{"record":{"id":"245b426bca37fa78","repo":"apache/pulsar","slug":"source-archive-not-specified","errorCode":null,"errorMessage":"Source archive not specified","messagePattern":"Source archive not specified","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java","lineNumber":529,"sourceCode":"\n            // check if source configs are valid\n            validateSourceConfigs(sourceConfig);\n        }\n\n        protected Map<String, Object> parseConfigs(String str) throws JsonProcessingException {\n            ObjectMapper mapper = ObjectMapperFactory.getMapper().getObjectMapper();\n            TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {};\n\n            return mapper.readValue(str, typeRef);\n        }\n\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","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java#L511-L547","documentation":"validateSourceConfigs requires sourceConfig.archive to be set before a source can be deployed; the archive identifies the NAR/package containing the source implementation. A blank archive yields this ParameterException.","triggerScenarios":"Running `pulsar-admin sources create` with neither --archive nor --source-type (the latter would have been converted to builtin://...), so the SourceConfig has no archive.","commonSituations":"Forgetting the archive flag; a --source-config-file JSON lacking the archive field; typo in the flag so it is silently ignored.","solutions":["Add --archive /path/to/source.nar (or a package:// URL)","Or add --source-type <name> to use a built-in connector","Include the archive field in the source config JSON file if using one"],"exampleFix":"// before\npulsar-admin sources create --tenant t --namespace n --name s --destination-topic-name o\n// after\npulsar-admin sources create --tenant t --namespace n --name s --destination-topic-name o --source-type kafka","handlingStrategy":"validation","validationCode":"if (!args.includes('--archive') && !args.includes('--source-type')) {\n  throw new Error('Source requires --archive or --source-type');\n}","typeGuard":"const sourceReady = (c) => Boolean(c && (c.archive || c.sourceType));","tryCatchPattern":"try {\n  // run sources create\n} catch (e) {\n  if (e.message.includes('Source archive not specified')) { /* add --archive/--source-type */ }\n  throw e;\n}","preventionTips":["Always supply --archive or --source-type on source create/update","Verify source-config JSON files include the archive field","Check flag spellings in deployment scripts"],"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-14T05:17:10.506Z"}