{"record":{"id":"45fd8fd2d51e7e4d","repo":"apache/beam","slug":"no-classpath-elements-found","errorCode":null,"errorMessage":"No classpath elements found.","messagePattern":"No classpath elements found\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/TransformProvider.java","lineNumber":214,"sourceCode":"            || options.as(ExpansionServiceOptions.class).getUseConfigDependenciesForManaged())) {\n      List<String> updatedDependencies =\n          config.getDependencies().get(transformUniqueID).stream()\n              .map(dependency -> dependency.getPath())\n              .collect(Collectors.toList());\n      return updatedDependencies;\n    }\n\n    List<String> filesToStage = options.as(PortablePipelineOptions.class).getFilesToStage();\n\n    if (filesToStage == null || filesToStage.isEmpty()) {\n      ClassLoader classLoader = Environments.class.getClassLoader();\n      if (classLoader == null) {\n        throw new RuntimeException(\n            \"Cannot detect classpath: classloader is null (is it the bootstrap classloader?)\");\n      }\n      filesToStage = PipelineResources.detectClassPathResourcesToStage(classLoader, options);\n      if (filesToStage.isEmpty()) {\n        throw new IllegalArgumentException(\"No classpath elements found.\");\n      }\n    }\n    return filesToStage;\n  }\n}\n","sourceCodeStart":196,"sourceCodeEnd":220,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/TransformProvider.java#L196-L220","documentation":"If filesToStage is unset and classpath auto-detection yields an empty list, getDependencies throws IllegalArgumentException because an expansion service with no classpath resources cannot stage dependencies for workers.","triggerScenarios":"Starting the expansion service with a classpath so minimal (e.g. single thin jar, jlink image) that PipelineResources.detectClassPathResourcesToStage finds nothing to stage.","commonSituations":"Modular/jlink runtime images; running from a REPL or tool that uses a custom classloader exposing no filesystem jars.","solutions":["Set --filesToStage to an explicit list of jars to stage","Launch with a conventional classpath containing the service and its dependencies","If intentional (dependencies provided another way), supply an empty-string-safe config or pre-populate filesToStage via options","Verify detectClassPathResourcesToStage output with the same classloader in a diagnostic run"],"exampleFix":"// before\njava --module-path mods ... ExpansionService  // detection finds nothing\n// after\njava -cp \"libs/*\" ExpansionService --filesToStage=libs/beam-sdks-java-expansion-service.jar","handlingStrategy":"validation","validationCode":"List<String> cp = PipelineResources.detectClassPathResourcesToStage(\n    TransformProvider.class.getClassLoader(), options);\nif (cp.isEmpty()) { options.as(PortablePipelineOptions.class)\n    .setFilesToStage(Collections.singletonList(System.getProperty(\"java.class.path\"))); }","typeGuard":null,"tryCatchPattern":"try { deps = provider.getDependencies(request); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"No classpath\")) { /* set filesToStage and retry */ } else throw e; }","preventionTips":["Launch with a standard fat/classpath layout","Set --filesToStage explicitly in containers/jlink images","Smoke-test classpath detection after packaging changes"],"tags":["java","classpath","expansion-service"],"backgroundTag":"empty-required-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}