{"record":{"id":"a52f4b7eb6264786","repo":"apache/beam","slug":"unable-to-create-a-side-input-view-from-input","errorCode":null,"errorMessage":"Unable to create a side-input view from input","messagePattern":"Unable to create a side-input view from input","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/View.java","lineNumber":295,"sourceCode":"      return inMemory(true);\n    }\n\n    /**\n     * Returns a PCollection view like this one, but whose resulting list will be entirely cached in\n     * memory according to the input parameter.\n     *\n     * <p>This may use more memory in exchange for the fastest access when used repeatedly.\n     */\n    public AsList<T> inMemory(boolean inMemory) {\n      return new AsList<>(withRandomAccess, inMemory);\n    }\n\n    @Override\n    public PCollectionView<List<T>> expand(PCollection<T> input) {\n      try {\n        GroupByKey.applicableTo(input);\n      } catch (IllegalStateException e) {\n        throw new IllegalStateException(\"Unable to create a side-input view from input\", e);\n      }\n      boolean explicitWithRandomAccess =\n          withRandomAccess != null\n              ? withRandomAccess\n              : StreamingOptions.updateCompatibilityVersionLessThan(\n                  input.getPipeline().getOptions(), \"2.57.0\");\n      if (inMemory) {\n        return expandInMemory(input);\n      } else if (explicitWithRandomAccess\n          || !(input.getWindowingStrategy().getWindowFn() instanceof GlobalWindows)) {\n        return expandWithRandomAccess(input);\n      } else {\n        return expandWithoutRandomAccess(input);\n      }\n    }\n\n    private PCollectionView<List<T>> expandInMemory(PCollection<T> input) {\n      if (input.getWindowingStrategy().getWindowFn() instanceof GlobalWindows) {","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/View.java#L277-L313","documentation":"View.asList() builds a PCollectionView that requires its input PCollection to be windowable/groupable (non-global windows that are unsupported, e.g. invalidWindowing or unsupported windowing/coder situations). Beam calls GroupByKey.applicableTo(input) as a pre-check and wraps any IllegalStateException from it into 'Unable to create a side-input view from input'.","triggerScenarios":"Applying View.asList() (or asList-like view) to a PCollection whose windowing strategy is incompatible with GroupByKey — e.g. PCollection created from a source with non-standard windowing, or one where windowing is not supported (like certain side-input/GBK-invalid cases such as already-grouped or collapsing window kinds).","commonSituations":"Creating side inputs from PCollections with unsupported windowing strategies; using views on globalWindows after merging; constructing views from sources with invalid windowing (e.g. timestamps with invalid strategy); attempting side input from a PCollection with incompatible windowing/coder combos.","solutions":["Ensure the input PCollection uses a windowing strategy compatible with GroupByKey (e.g. standard windowed or global window)","Call Window.into(...) on the input PCollection before creating the view","If the input comes from a source with non-standard windowing, re-window it before viewing"],"exampleFix":"// before\nPCollectionView<List<T>> view = weirdWindowedPCollection.apply(View.asList());\n// after\nPCollectionView<List<T>> view = weirdWindowedPCollection\n    .apply(Window.into(FixedWindows.of(Duration.standardMinutes(1))))\n    .apply(View.asList());","handlingStrategy":"validation","validationCode":"try { GroupByKey.applicableTo(input); } catch (IllegalStateException e) { /* re-window input first */ }","typeGuard":null,"tryCatchPattern":"try { view = input.apply(View.asList()); } catch (IllegalStateException e) { throw new IllegalStateException(\"Re-window the input before creating side input\", e); }","preventionTips":["Apply Window.into(...) with a standard strategy before creating views","Avoid building side inputs from PCollections with exotic/unsupported windowing","Check upstream sources for non-standard windowing strategies"],"tags":["java","apache-beam","side-input","windowing"],"backgroundTag":"incompatible-source-type","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"}