{"record":{"id":"8bff5f220c7833da","repo":"apache/beam","slug":"no-fields-were-set-for-input-tag","errorCode":null,"errorMessage":"No fields were set for input ${tag}","messagePattern":"No fields were set for input (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java","lineNumber":383,"sourceCode":"              .map(TupleTag::getId)\n              .sorted()\n              .collect(Collectors.toList());\n\n      // Keep this in a TreeMap so that it's sorted. This way we get a deterministic output\n      // schema.\n      TreeMap<String, Schema> componentSchemas = Maps.newTreeMap();\n\n      Map<String, PCollectionView<Map<Row, Iterable<Row>>>> sideInputs = Maps.newHashMap();\n      Map<Integer, String> tagToKeyedTag = Maps.newHashMap();\n      Schema keySchema = null;\n      for (Map.Entry<TupleTag<?>, PCollection<?>> entry : input.getAll().entrySet()) {\n        String tag = entry.getKey().getId();\n        PCollection<?> pc = entry.getValue();\n        Schema schema = pc.getSchema();\n        componentSchemas.put(tag, schema);\n        FieldAccessDescriptor fieldAccessDescriptor = getFieldAccessDescriptor.apply(tag);\n        if (fieldAccessDescriptor == null) {\n          throw new IllegalStateException(\"No fields were set for input \" + tag);\n        }\n        // Resolve the key schema, keeping the fields in the order specified by the user.\n        // Otherwise, if different field names are specified for different PCollections, they\n        // might not match up.\n        // The key schema contains the field names from the first PCollection specified.\n        FieldAccessDescriptor resolved = fieldAccessDescriptor.resolve(schema);\n        Schema currentKeySchema = SelectHelpers.getOutputSchema(schema, resolved);\n        if (keySchema == null) {\n          keySchema = currentKeySchema;\n        } else {\n          keySchema = SchemaUtils.mergeWideningNullable(keySchema, currentKeySchema);\n        }\n      }\n      // Second loop so we can widen the keySchema with every input before using it\n      for (Map.Entry<TupleTag<?>, PCollection<?>> entry : input.getAll().entrySet()) {\n        String tag = entry.getKey().getId();\n        int tagIndex = sortedTags.indexOf(tag);\n        PCollection<?> pc = entry.getValue();","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java#L365-L401","documentation":"CoGroup.from builds the transform's key schemas by looking up, for each input PCollection tag, the FieldAccessDescriptor supplied via join clauses. If a tag in the PCollectionTuple has no corresponding field descriptor, it throws IllegalStateException, since every input must define its join key fields.","triggerScenarios":"Constructing CoGroup via CoGroup.from(tuple) where the Impl's join fields were set with byFieldDescriptors (a map keyed by tag) that is missing an entry for one of the tuple's tags — e.g. joins specified for tags 'a' and 'b' but the tuple also contains tag 'c'.","commonSituations":"Forgetting a per-tag .join(tag, By.field(...)) call before expanding; adding a third input PCollection to the tuple without adding a matching join clause; tag name typos (TupleTag id differs from the string used in join).","solutions":["Add a join(tag, By.field(...)) clause for every tag present in the PCollectionTuple.","Verify tag ids: TupleTag.getId() must exactly match the tag strings used in join() calls.","Use the global byFields(...) variant if all inputs should use the same key fields, instead of per-tag clauses.","Print input.getAll().keySet() and the join args map and diff them before building the transform."],"exampleFix":"// before (tag \"c\" in tuple, no clause)\nCoGroup join = CoGroup\n    .join(\"a\", By.field(\"key\")).join(\"b\", By.field(\"key\"))\n    .from(tuple); // throws: no fields for \"c\"\n// after\nCoGroup join = CoGroup\n    .join(\"a\", By.field(\"key\")).join(\"b\", By.field(\"key\"))\n    .join(\"c\", By.field(\"key\"))\n    .from(tuple);","handlingStrategy":"validation","validationCode":"Set<String> tags = tuple.getAll().keySet().stream().map(TupleTag::getId).collect(Collectors.toSet());\nSet<String> joined = joinArgsMap.keySet();\nif (!tags.equals(joined)) throw new IllegalStateException(\"missing join clauses for tags: \" + Sets.difference(tags, joined));","typeGuard":null,"tryCatchPattern":"try { CoGroup g = builder.from(tuple); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"No fields were set for input\")) { /* add missing join(tag,...) */ } else throw e; }","preventionTips":["Always build per-tag join clauses from tuple.getAll().keySet() programmatically","Compare TupleTag.getId() strings, never assume object identity","Add a pre-flight assertion comparing tag sets before from()"],"tags":["java","apache-beam","co-group","join"],"backgroundTag":"missing-required-argument","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"}