{"record":{"id":"6b0c21cf1031b536","repo":"apache/beam","slug":"no-runner-was-specified-and-the-directrunner-was-not-found","errorCode":null,"errorMessage":"No Runner was specified and the DirectRunner was not found on the classpath.%nSpecify a runner by either:%n    Explicitly specifying a runner by providing the 'runner' property%n    Adding the DirectRunner to the classpath%n    Calling 'PipelineOptions.setRunner(PipelineRunner)' directly","messagePattern":"No Runner was specified and the DirectRunner was not found on the classpath\\.%nSpecify a runner by either:%n    Explicitly specifying a runner by providing the 'runner' property%n    Adding the DirectRunner to the classpath%n    Calling 'PipelineOptions\\.setRunner\\(PipelineRunner\\)' directly","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptions.java","lineNumber":316,"sourceCode":"   *\n   * <p>As the {@code DirectRunner} is in an independent module, it cannot be directly referenced as\n   * the {@link Default}. However, it should still be used if available, and a user is required to\n   * explicitly set the {@code --runner} property if they wish to use an alternative runner.\n   */\n  class DirectRunner implements DefaultValueFactory<Class<? extends PipelineRunner<?>>> {\n    @Override\n    public Class<? extends PipelineRunner<?>> create(PipelineOptions options) {\n      try {\n        @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n        Class<? extends PipelineRunner<?>> direct =\n            (Class<? extends PipelineRunner<?>>)\n                Class.forName(\n                    \"org.apache.beam.runners.direct.DirectRunner\",\n                    true,\n                    ReflectHelpers.findClassLoader());\n        return direct;\n      } catch (ClassNotFoundException e) {\n        throw new IllegalArgumentException(\n            String.format(\n                \"No Runner was specified and the DirectRunner was not found on the classpath.%n\"\n                    + \"Specify a runner by either:%n\"\n                    + \"    Explicitly specifying a runner by providing the 'runner' property%n\"\n                    + \"    Adding the DirectRunner to the classpath%n\"\n                    + \"    Calling 'PipelineOptions.setRunner(PipelineRunner)' directly\"));\n      }\n    }\n  }\n\n  /**\n   * Returns a normalized job name constructed from {@link ApplicationNameOptions#getAppName()}, the\n   * local system user name (if available), the current time, and a random integer.\n   *\n   * <p>The normalization makes sure that the name matches the pattern of\n   * [a-z]([-a-z0-9]*[a-z0-9])?.\n   */\n  class JobNameFactory implements DefaultValueFactory<String> {","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptions.java#L298-L334","documentation":"PipelineOptions.create() resolves the runner: if no --runner property was given, it tries to load the DirectRunner class reflectively. When neither a runner is specified nor DirectRunner is on the classpath, it throws IllegalArgumentException listing the ways to specify a runner.","triggerScenarios":"Calling PipelineOptions.create() (or Pipeline.create()) without a --runner option while beam-runners-direct-java is absent from the classpath — common in slim production images or when depending only on sdks-core.","commonSituations":"Production deployments that removed the DirectRunner but forgot to set --runner, libraries embedding Beam without a runner dependency, and tests running outside the default Beam classpath.","solutions":["Set the runner: --runner=<YourRunner> via options, argv, or PipelineOptionsFactory.fromArgs.","Call PipelineOptions.setRunner(YourRunner.class) programmatically before building the Pipeline.","Add the desired runner artifact (e.g. beam-runners-direct-java, beam-runners-dataflow-java) to the classpath.","In production, always configure --runner explicitly rather than relying on the DirectRunner default."],"exampleFix":"// before\nPipelineOptions options = PipelineOptionsFactory.create();\n// after\nPipelineOptions options = PipelineOptionsFactory.fromArgs(new String[]{\"--runner=FlinkRunner\"}).create();","handlingStrategy":"validation","validationCode":"if (options.getRunner() == null && !hasClass(\"org.apache.beam.runners.direct.DirectRunner\")) { options.setRunner(ProductionRunner.class); }","typeGuard":null,"tryCatchPattern":"try { pipeline = Pipeline.create(options); } catch (IllegalArgumentException e) { LOG.error(\"runner misconfigured: \" + e.getMessage()); throw e; }","preventionTips":["Always pass --runner explicitly in non-interactive environments","Ship a runner artifact with your application dependencies","Fail fast with a startup check for the configured runner class"],"tags":["apache-beam","classpath","runner-configuration"],"backgroundTag":"class-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}