{"record":{"id":"21da47a76b149a77","repo":"apache/beam","slug":"a-s-cannot-be-expanded","errorCode":null,"errorMessage":"A %s cannot be expanded","messagePattern":"A (.+?) cannot be expanded","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/RunnerPCollectionView.java","lineNumber":95,"sourceCode":"\n  @Override\n  public WindowMappingFn<?> getWindowMappingFn() {\n    return windowMappingFn;\n  }\n\n  @Override\n  public WindowingStrategy<?, ?> getWindowingStrategyInternal() {\n    return windowingStrategy;\n  }\n\n  @Override\n  public Coder<?> getCoderInternal() {\n    return coder;\n  }\n\n  @Override\n  public Map<TupleTag<?>, PValue> expand() {\n    throw new UnsupportedOperationException(\n        String.format(\"A %s cannot be expanded\", RunnerPCollectionView.class.getSimpleName()));\n  }\n\n  @Override\n  public boolean equals(@Nullable Object other) {\n    if (!(other instanceof PCollectionView)) {\n      return false;\n    }\n    @SuppressWarnings(\"unchecked\")\n    PCollectionView<?> otherView = (PCollectionView<?>) other;\n    return tag.equals(otherView.getTagInternal());\n  }\n\n  @Override\n  public int hashCode() {\n    return Objects.hash(tag);\n  }\n}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/RunnerPCollectionView.java#L77-L113","documentation":"RunnerPCollectionView is a runner-side placeholder implementation of PCollectionView used during pipeline construction/translation. It carries only a coder and TupleTag and has no backing PTransform, so expand() unconditionally throws UnsupportedOperationException: 'A RunnerPCollectionView cannot be expanded'. PValues are normally expanded during pipeline construction; a runner view should never participate in that.","triggerScenarios":"Calling expand() (directly, or via PValue.expansion / getProducingTransformInternal / pipeline application logic) on a PCollectionView that is a RunnerPCollectionView — e.g. iterating over a pipeline's PValues and calling expand() on views obtained from a translated/runner-side context instead of the original user-built view.","commonSituations":"Custom runners or pipeline-manipulation code that walks PValues and calls expand(), passing runner-created views into APIs that expect construction-time views, or mixing views between two different Pipeline instances.","solutions":["Do not call expand() on RunnerPCollectionView; keep a reference to the original user-side PCollectionView if expansion metadata is needed.","When walking a pipeline graph, treat views as already-expanded leaves and skip them (check instanceof RunnerPCollectionView).","Ensure side inputs passed to transforms come from the same Pipeline that is being built, not from a translated/runner representation."],"exampleFix":"// before\nfor (PValue value : pCollection.expand()) { ... }\n// after\nif (!(view instanceof RunnerPCollectionView)) {\n  for (PValue value : view.expand()) { ... }\n}","handlingStrategy":"type-guard","validationCode":"if (view instanceof RunnerPCollectionView) { skipExpansion(view); }","typeGuard":"boolean isRunnerView(PValue v) { return v instanceof RunnerPCollectionView; }","tryCatchPattern":"try { values = view.expand(); } catch (UnsupportedOperationException e) { /* runner view: treat as expanded leaf */ }","preventionTips":["Never call expand() on runner-side views","Use original user-built PCollectionViews for metadata","When walking pipelines, skip RunnerPCollectionView instances"],"tags":["java","beam","runner","pvalue","unsupported"],"backgroundTag":"unsupported-operation","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"}