{"record":{"id":"1c020d91824771c4","repo":"apache/beam","slug":"unknown-s-s-pcollectiontranslation","errorCode":null,"errorMessage":"Unknown %s %s","messagePattern":"Unknown (.+?) (.+?)","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/PCollectionTranslation.java","lineNumber":70,"sourceCode":"    return PCollection.createPrimitiveOutputInternal(\n        pipeline,\n        components.getWindowingStrategy(pCollection.getWindowingStrategyId()),\n        fromProto(pCollection.getIsBounded()),\n        (Coder) coder);\n  }\n\n  public static IsBounded isBounded(RunnerApi.PCollection pCollection) {\n    return fromProto(pCollection.getIsBounded());\n  }\n\n  static RunnerApi.IsBounded.Enum toProto(IsBounded bounded) {\n    switch (bounded) {\n      case BOUNDED:\n        return RunnerApi.IsBounded.Enum.BOUNDED;\n      case UNBOUNDED:\n        return RunnerApi.IsBounded.Enum.UNBOUNDED;\n      default:\n        throw new IllegalArgumentException(\n            String.format(\"Unknown %s %s\", IsBounded.class.getSimpleName(), bounded));\n    }\n  }\n\n  static IsBounded fromProto(RunnerApi.IsBounded.Enum isBounded) {\n    switch (isBounded) {\n      case BOUNDED:\n        return IsBounded.BOUNDED;\n      case UNBOUNDED:\n        return IsBounded.UNBOUNDED;\n      case UNRECOGNIZED:\n      default:\n        // Whether or not this enum cannot be recognized by the proto (due to the version of the\n        // generated code we link to) or the switch hasn't been updated to handle it,\n        // the situation is the same: we don't know what this IsBounded means\n        throw new IllegalArgumentException(\n            String.format(\n                \"Cannot convert unknown %s to %s: %s\",","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/PCollectionTranslation.java#L52-L88","documentation":"PCollectionTranslation.toProto converts a Java IsBounded to the protobuf enum. The switch handles BOUNDED and UNBOUNDED; anything else (i.e. a null or future-added value) reaches the default branch and throws this IllegalArgumentException.","triggerScenarios":"Calling toProto(pcollection) (via PTransform translation) when pcollection.isBounded() returns a value not covered by the switch — in practice only null or a corrupted/extended IsBounded enum.","commonSituations":"Custom pipeline construction passing a null isBounded; reflective or mocked IsBounded values in tests; exotic IsBounded additions from a newer SDK mixed with older translation code.","solutions":["Ensure the PCollection was constructed normally so isBounded() is non-null.","Check for custom code or tests that stub IsBounded with unexpected values.","Update to a matching Beam version so the switch covers all IsBounded values."],"exampleFix":"// before\nIsBounded bounded = mockPcollection.isBounded(); // returns null\ntoProto(mockPcollection);\n// after\ncheckArgument(mockPcollection.isBounded() != null, \"isBounded must be set\");\ntoProto(mockPcollection);","handlingStrategy":"validation","validationCode":"if (pcollection.isBounded() == null) throw new IllegalArgumentException(\"PCollection isBounded must be set\");","typeGuard":"null","tryCatchPattern":"try { toProto(pc); } catch (IllegalArgumentException e) { /* Unknown IsBounded — inspect pc construction */ throw e; }","preventionTips":["Always construct PCollections through the normal Pipeline API","Don't stub IsBounded in tests","Keep the SDK version consistent"],"tags":["java","proto","translation","enum"],"backgroundTag":"invalid-enum-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"}