{"record":{"id":"c265a736fecb1a69","repo":"apache/beam","slug":"the-input-pcollectiontuple-has-tags-inputtags-and-the-join","errorCode":null,"errorMessage":"The input PCollectionTuple has tags: ${inputTags} and the join was specified for tags ${joinTags}. These do not match.","messagePattern":"The input PCollectionTuple has tags: (.+?) and the join was specified for tags (.+?)\\. These do not match\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java","lineNumber":458,"sourceCode":"                        new RowSelectorContainer(schema, keyFields, true);\n\n                    @ProcessElement\n                    public void process(@Element Row row, OutputReceiver<KV<Row, Row>> o) {\n                      o.output(KV.of(rowSelector.select(row), row));\n                    }\n                  }))\n          .setCoder(KvCoder.of(SchemaCoder.of(keySchema), SchemaCoder.of(schema)));\n    }\n  }\n\n  static void verify(PCollectionTuple input, JoinArguments joinArgs) {\n    if (joinArgs.allInputsJoinArgs == null) {\n      // If explicit join tags were specified, then they must match the input tuple.\n      Set<String> inputTags =\n          input.getAll().keySet().stream().map(TupleTag::getId).collect(Collectors.toSet());\n      Set<String> joinTags = joinArgs.joinArgsMap.keySet();\n      if (!inputTags.equals(joinTags)) {\n        throw new IllegalArgumentException(\n            \"The input PCollectionTuple has tags: \"\n                + inputTags\n                + \" and the join was specified for tags \"\n                + joinTags\n                + \". These do not match.\");\n      }\n    }\n  }\n\n  @AutoValue\n  public abstract static class Result {\n    abstract Row getKey();\n\n    abstract List<Iterable<Row>> getIterables();\n\n    abstract List<String> getTags();\n\n    abstract JoinArguments getJoinArguments();","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java#L440-L476","documentation":"CoGroup.Impl.verify checks that the set of tags in the input PCollectionTuple exactly equals the set of tags for which join arguments were specified. A mismatch (extra inputs, missing clauses, or misspelled tags) throws IllegalArgumentException listing both sets.","triggerScenarios":"Expanding a CoGroup.Impl where joinArgs.joinArgsMap.keySet() differs from input.getAll() tag ids — e.g. joining on tags {a,b} while the tuple contains {a,b,c}, or per-tag join() calls using tag strings that don't match TupleTag.getId().","commonSituations":"TupleTag instances created with new TupleTag<>(\"in1\") whose getId() differs from the plain object identity keys users assume; adding inputs to the tuple after specifying join clauses; typos in tag strings.","solutions":["Make the join tag set exactly match the tuple's tags: add or remove join(tag, By...) clauses accordingly.","Compare TupleTag.getId() strings, not TupleTag object references, when specifying tags.","Use the allInputs byFields(...) global form so tag matching is not required.","Log both sets (they are in the message) and fix the divergent side."],"exampleFix":"// before\nCoGroup.join(\"left\", By.field(\"k\")).join(\"right\", By.field(\"k\"))\n    .from(tupleWithThreeInputs); // tags {left,right,extra}\n// after\nCoGroup.join(\"left\", By.field(\"k\")).join(\"right\", By.field(\"k\"))\n    .join(\"extra\", By.field(\"k\"))\n    .from(tupleWithThreeInputs);","handlingStrategy":"validation","validationCode":"Set<String> inputTags = tuple.getAll().keySet().stream().map(TupleTag::getId).collect(Collectors.toSet());\nSet<String> joinTags = joinArgsMap.keySet();\nif (!inputTags.equals(joinTags)) { log.warn(\"tag mismatch: {} vs {}\", inputTags, joinTags); }","typeGuard":null,"tryCatchPattern":"try { result = coGroup.expand(tuple); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"These do not match\")) { /* reconcile tag sets */ } else throw e; }","preventionTips":["Derive join tags from the same TupleTag constants used to build the tuple","Avoid creating duplicate TupleTags with different ids for the same logical input","Verify tag sets in unit tests before expanding"],"tags":["java","apache-beam","co-group","join","tag-mismatch"],"backgroundTag":"invalid-argument-value","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"}