{"record":{"id":"8224ecd9ead71a94","repo":"apache/beam","slug":"only-materializations-of-type-s-supported-received-s","errorCode":null,"errorMessage":"Only materializations of type %s supported, received %s","messagePattern":"Only materializations of type (.+?) supported, received (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnTester.java","lineNumber":633,"sourceCode":"        case Materializations.ITERABLE_MATERIALIZATION_URN:\n          return ((ViewFn<Materializations.IterableView, T>) view.getViewFn())\n              .apply(() -> Collections.emptyList());\n        case Materializations.MULTIMAP_MATERIALIZATION_URN:\n          return ((ViewFn<Materializations.MultimapView, T>) view.getViewFn())\n              .apply(\n                  new MultimapView() {\n                    @Override\n                    public Iterable get() {\n                      return Collections.emptyList();\n                    }\n\n                    @Override\n                    public Iterable get(@Nullable Object o) {\n                      return Collections.emptyList();\n                    }\n                  });\n        default:\n          throw new IllegalStateException(\n              String.format(\n                  \"Only materializations of type %s supported, received %s\",\n                  Arrays.asList(\n                      Materializations.ITERABLE_MATERIALIZATION_URN,\n                      Materializations.MULTIMAP_MATERIALIZATION_URN),\n                  view.getViewFn().getMaterialization().getUrn()));\n      }\n    }\n\n    @Override\n    public Instant timestamp() {\n      return element.getTimestamp();\n    }\n\n    @Override\n    public PaneInfo pane() {\n      return element.getPaneInfo();\n    }","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnTester.java#L615-L651","documentation":"When a DoFn declares a side input, DoFnTester maps the view's materialization URN onto a MockSideInputContainer. Only ITERABLE and MULTIMAP materializations are supported; any other URN (e.g. a custom or newer materialization type) triggers this IllegalStateException.","triggerScenarios":"Calling DoFnTester.withSideInputs(...) with a PCollectionView whose ViewFn reports a materialization URN other than Materializations.ITERABLE_MATERIALIZATION_URN or MULTIMAP_MATERIALIZATION_URN.","commonSituations":"Testing a DoFn with side inputs whose view comes from a custom CombineFn or a runner-specific view implementation producing an exotic materialization; Beam upgrades adding new materialization types DoFnTester doesn't know.","solutions":["Use a standard view (View.asIterable / View.asMap / View.asMultimap) so the materialization is ITERABLE or MULTIMAP","Inject side-input data into DoFnTester via withSideInputs plus a view backed by a supported materialization","Test the DoFn in a full TestPipeline run if custom side-input materializations are required"],"exampleFix":"// before\nPCollectionView<Map<K,V>> view = customExperimentalView();\n// after\nPCollectionView<Map<K,V>> view = input.apply(View.asMap());","handlingStrategy":"validation","validationCode":"String urn = view.getViewFn().getMaterialization().getUrn();\nboolean ok = urn.equals(Materializations.ITERABLE_MATERIALIZATION_URN)\n          || urn.equals(Materializations.MULTIMAP_MATERIALIZATION_URN);\nif (!ok) throw new IllegalStateException(\"DoFnTester cannot test this view: \" + urn);","typeGuard":"boolean isTestableView(PCollectionView<?> v) {\n  String urn = v.getViewFn().getMaterialization().getUrn();\n  return urn.equals(Materializations.ITERABLE_MATERIALIZATION_URN)\n      || urn.equals(Materializations.MULTIMAP_MATERIALIZATION_URN);\n}","tryCatchPattern":"try { tester.withSideInputs(view); }\ncatch (IllegalStateException e) { /* fall back to TestPipeline run */ }","preventionTips":["Use standard View.asIterable/asMap/asMultimap for side inputs in tests","Check the materialization URN before wiring side inputs into DoFnTester","Prefer TestPipeline when using custom view implementations"],"tags":["java","apache-beam","side-input","testing"],"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"}