{"record":{"id":"bbb36985778b2dd6","repo":"apache/beam","slug":"s-is-for-internal-use-only-and-does-not-support-case","errorCode":null,"errorMessage":"%s is for internal use only and does not support case dispatch","messagePattern":"(.+?) is for internal use only and does not support case dispatch","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/state/StateSpecs.java","lineNumber":558,"sourceCode":"\n    private @Nullable Coder<AccumT> accumCoder;\n    private final CombineFnWithContext<InputT, AccumT, OutputT> combineFn;\n\n    private CombiningWithContextStateSpec(\n        @Nullable Coder<AccumT> accumCoder,\n        CombineFnWithContext<InputT, AccumT, OutputT> combineFn) {\n      this.combineFn = combineFn;\n      this.accumCoder = accumCoder;\n    }\n\n    @Override\n    public CombiningState<InputT, AccumT, OutputT> bind(String id, StateBinder visitor) {\n      return visitor.bindCombiningWithContext(id, this, accumCoder, combineFn);\n    }\n\n    @Override\n    public <ResultT> ResultT match(Cases<ResultT> cases) {\n      throw new UnsupportedOperationException(\n          String.format(\n              \"%s is for internal use only and does not support case dispatch\",\n              getClass().getSimpleName()));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public void offerCoders(Coder[] coders) {\n      if (this.accumCoder == null && coders[2] != null) {\n        this.accumCoder = (Coder<AccumT>) coders[2];\n      }\n    }\n\n    @Override\n    public void finishSpecifying() {\n      if (accumCoder == null) {\n        throw new IllegalStateException(\n            \"Unable to infer a coder for\"","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/state/StateSpecs.java#L540-L576","documentation":"CombiningWithContextStateSpec.match(Cases) is unsupported: this spec is for internal use only and does not participate in the StateSpec case-dispatch (visitor/Cases) mechanism. It always throws UnsupportedOperationException.","triggerScenarios":"Calling .match(cases) on a CombiningWithContextStateSpec obtained from StateSpecs.combiningWithContext(...), or runner/framework code that generically dispatches over all StateSpecs with Cases.","commonSituations":"Runner authors writing generic state-spec handling code; users reflecting over state cells and trying to pattern-match spec types.","solutions":["Do not dispatch on this spec with Cases; use the StateBinder visitor path (bind()) instead.","If you need the combineFn/coder, access the spec's fields directly rather than via match().","Treat CombiningWithContextState as internal and route handling through bindCombiningWithContext."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (spec instanceof CombiningWithContextStateSpec) { /* handle via bind/visitor, never .match() */ }","typeGuard":"boolean supportsCaseDispatch(StateSpec<?, ?> s) { return !(s instanceof CombiningWithContextStateSpec); }","tryCatchPattern":"try {\n  return spec.match(cases);\n} catch (UnsupportedOperationException e) {\n  // route CombiningWithContext specs through StateBinder.bindCombiningWithContext instead\n  return handleWithContextBinder(spec);\n}","preventionTips":["Treat CombiningWithContextStateSpec as internal API","Use StateBinder visitors instead of Cases dispatch","In generic runner code, add an instanceof branch before calling match()"],"tags":["java","apache-beam","internal-api","unsupported-operation"],"backgroundTag":"method-not-implemented","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"}