{"record":{"id":"688fde002452b786","repo":"apache/beam","slug":"calling-getsideinput-with-unknown-view","errorCode":null,"errorMessage":"calling getSideInput() with unknown view","messagePattern":"calling getSideInput\\(\\) with unknown view","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/SplittableParDo.java","lineNumber":563,"sourceCode":"                    public InputT element(DoFn<InputT, OutputT> doFn) {\n                      return c.element();\n                    }\n\n                    @Override\n                    public Instant timestamp(DoFn<InputT, OutputT> doFn) {\n                      return c.timestamp();\n                    }\n\n                    @Override\n                    public PipelineOptions pipelineOptions() {\n                      return c.getPipelineOptions();\n                    }\n\n                    @Override\n                    public Object sideInput(String tagId) {\n                      PCollectionView<?> view = sideInputMapping.get(tagId);\n                      if (view == null) {\n                        throw new IllegalArgumentException(\n                            \"calling getSideInput() with unknown view\");\n                      }\n                      return c.sideInput(view);\n                    }\n\n                    @Override\n                    public PaneInfo paneInfo(DoFn<InputT, OutputT> doFn) {\n                      return c.pane();\n                    }\n\n                    @Override\n                    public BoundedWindow window() {\n                      return w;\n                    }\n\n                    @Override\n                    public String getErrorContext() {\n                      return PairWithRestrictionFn.class.getSimpleName()","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/SplittableParDo.java#L545-L581","documentation":"In SplittableParDo's translated DoFn wrapper, the DoFnProcessContext.sideInput(tagId) callback looks up the requested tag id in sideInputMapping (built from the transform's declared side inputs) and throws IllegalArgumentException 'calling getSideInput() with unknown view' when the tag is absent, so the runner's side-input access can be mapped back to the user's PCollectionView. This happens when a DoFn requests a side input that was never declared for the transform.","triggerScenarios":"A DoFn's processElement (or an OnTimer/FinishBundle callback) calls c.sideInput(view) with a view that is not in the SplittableParDo transform's declared side-input list, so sideInputMapping.get(tagId) returns null.","commonSituations":"DoFns reading side inputs conditionally with views not passed via .withSideInputs(), refactored pipelines where a side input was removed from withSideInputs but still accessed in the DoFn, or views from a different Pipeline instance.","solutions":["Add the missing view to the ParDo transform: ParDo.of(fn).withSideInputs(view1, view2).","Audit the DoFn for every c.sideInput(...) call and ensure each view is declared.","Verify the view belongs to the same Pipeline and was not constructed for another graph."],"exampleFix":"// before\nPCollection<String> out = items.apply(ParDo.of(fn)); // fn calls c.sideInput(mapView)\n// after\nPCollection<String> out = items.apply(ParDo.of(fn).withSideInputs(mapView));","handlingStrategy":"validation","validationCode":"Set<TupleTag<?>> declared = pardo.getSideInputs().keySet(); checkAccessedSideInputs(doFn, declared); // fail fast if DoFn reads undeclared views","typeGuard":null,"tryCatchPattern":"try { return c.sideInput(view); } catch (IllegalArgumentException e) { throw new IllegalStateException(\"Side input view must be declared via withSideInputs()\", e); }","preventionTips":["Every c.sideInput() view must appear in withSideInputs()","Grep DoFns for sideInput calls during review","Re-declare side inputs after refactors"],"tags":["java","beam","side-input","splittable-pardo","dofn"],"backgroundTag":"resource-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}