{"record":{"id":"1c0a2205d16d9bb7","repo":"apache/beam","slug":"the-pipeline-has-not-been-run","errorCode":null,"errorMessage":"The pipeline has not been run.","messagePattern":"The pipeline has not been run\\.","errorType":"exception","errorClass":"PipelineRunMissingException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestPipeline.java","lineNumber":215,"sourceCode":"    private List<TransformHierarchy.Node> recordPipelineNodes(final Pipeline pipeline) {\n      final NodeRecorder nodeRecorder = new NodeRecorder();\n      pipeline.traverseTopologically(nodeRecorder);\n      return nodeRecorder.visited;\n    }\n\n    private boolean isEmptyPipeline(final Pipeline pipeline) {\n      final IsEmptyVisitor isEmptyVisitor = new IsEmptyVisitor();\n      pipeline.traverseTopologically(isEmptyVisitor);\n      return isEmptyVisitor.isEmpty();\n    }\n\n    private void verifyPipelineExecution() {\n      if (isEmptyPipeline(pipeline)) {\n        return;\n      }\n\n      if (!runAttempted && !enableAutoRunIfMissing) {\n        throw new PipelineRunMissingException(\"The pipeline has not been run.\");\n      }\n\n      if (!pipelineRunSucceeded()) {\n        return; // this method is to protect against spurious success, so failure is fine\n      }\n\n      final List<TransformHierarchy.Node> runVisitedNodes =\n          checkStateNotNull(\n              this.runVisitedNodes,\n              \"Internal error: non-empty pipeline has been visited but still no runVisitedNodes\");\n      final List<TransformHierarchy.Node> pipelineNodes = recordPipelineNodes(pipeline);\n      if (runVisitedNodes.equals(pipelineNodes)) {\n        return;\n      }\n\n      final boolean hasDanglingPAssert =\n          pipelineNodes.stream()\n              .filter(Predicates.not(Predicates.in(runVisitedNodes)))","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestPipeline.java#L197-L233","documentation":"TestPipeline verifies, after the test body finishes, that a non-empty pipeline was actually run. If runAttempted is false (and auto-run is not enabled) it throws PipelineRunMissingException with this message, because assertions like PAssert only evaluate when the pipeline executes.","triggerScenarios":"Creating a TestPipeline, applying transforms/PAsserts, but never calling pipeline.run() before the test method ends; run() commented out or guarded behind a condition that never fires.","commonSituations":"Test refactorings that drop the run() call; tests skipped mid-way with early returns before run(); forgetting run() when switching from direct construction to TestPipeline.","solutions":["Call pipeline.run().waitUntilFinish() at the end of the test.","Enable auto-run of missing pipelines in test options if your workflow expects implicit runs (Beam can auto-run pipelines in tests via TestPipeline rule flags).","If the test intentionally builds no pipeline, keep it empty so isEmptyPipeline() short-circuits."],"exampleFix":"// before\nPAssert.that(pcoll).containsInAnyOrder(\"a\");\n// after\nPAssert.that(pcoll).containsInAnyOrder(\"a\");\npipeline.run().waitUntilFinish();","handlingStrategy":"validation","validationCode":"if (builtTransforms > 0 && !runAttempted) { throw new IllegalStateException(\"Test forgot pipeline.run()\"); }","typeGuard":null,"tryCatchPattern":"try { testLogic(); } catch (PipelineRunMissingException e) { fail(\"Add pipeline.run().waitUntilFinish() to the test\"); }","preventionTips":["End every TestPipeline test with pipeline.run().waitUntilFinish().","Avoid early returns in tests before run().","Enable TestPipeline auto-run in shared test config if desired."],"tags":["java","testing","apache-beam","pipeline"],"backgroundTag":"invalid-state-transition","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}