{"record":{"id":"b693c1d36d3966b0","repo":"apache/pulsar","slug":"source-archive-s-does-not-exist","errorCode":null,"errorMessage":"Source Archive %s does not exist","messagePattern":"Source Archive (.+?) does not exist","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java","lineNumber":535,"sourceCode":"            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\n        protected void validateBatchSourceConfigs(BatchSourceConfig batchSourceConfig) {\n            if (isBlank(batchSourceConfig.getDiscoveryTriggererClassName())) {\n                throw new IllegalArgumentException(\"Discovery Triggerer not specified\");\n            }\n        }\n","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java#L517-L553","documentation":"Thrown by validateSourceConfigs in the pulsar-admin CLI when a Source's configured archive is not a supported package URL and does not use the builtin:// scheme, yet no file exists at that path. The CLI must be able to locate the archive containing the Source's code before submitting it, so it verifies the file on local disk. This is a client-side argument validation failure; nothing was sent to the broker.","triggerScenarios":"Running `pulsar-admin sources create` (or update/localrun) with --archive pointing to a file path that does not exist, and the path is neither a supported package URL (http(s)://, file:// etc.) nor prefixed with builtin://.","commonSituations":"Typo in the archive path, running the CLI from a different working directory with a relative path, the nar/jar file not built yet or deleted, or forgetting to prefix with builtin:// when intending to use a bundled connector.","solutions":["Verify the file exists: ls the exact path passed to --archive","If using a built-in connector, change the archive to builtin://<connector-type> (e.g. builtin://kafka)","Use an absolute path instead of a relative one","Build the connector NAR first (mvn package) and point --archive at target/...nar"],"exampleFix":"// before\n--archive ./my-source.nar   (file is actually elsewhere)\n// after\n--archive /opt/connectors/my-source.nar\n// or for built-in:\n--archive builtin://kafka","handlingStrategy":"validation","validationCode":"String archive = sourceConfig.getArchive();\nif (!org.apache.pulsar.common.functions.Utils.isFunctionPackageUrlSupported(archive)\n        && !archive.startsWith(org.apache.pulsar.common.functions.Utils.BUILTIN)\n        && !new java.io.File(archive).exists()) {\n    throw new IllegalArgumentException(\"Archive does not exist: \" + archive);\n}","typeGuard":"boolean isValidArchive(String archive) {\n    return Utils.isFunctionPackageUrlSupported(archive)\n        || archive.startsWith(Utils.BUILTIN)\n        || new File(archive).exists();\n}","tryCatchPattern":"try {\n    admin.sources().createSource(sourceConfig);\n} catch (IllegalArgumentException e) {\n    System.err.println(\"Check --archive path: \" + e.getMessage());\n}","preventionTips":["Always use absolute paths for --archive in scripts","Use builtin://<type> for bundled connectors","Build the NAR and verify its path before running the CLI","Add a `test -f $ARCHIVE` guard in shell scripts"],"tags":["pulsar-admin","cli","io-connector","file-not-found"],"backgroundTag":"file-not-found","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"}