{"record":{"id":"605aa859e578264f","repo":"apache/beam","slug":"only-feedrangeepkimpl-are-supported-got-feedrange","errorCode":null,"errorMessage":"Only FeedRangeEpkImpl are supported. got: feedRange","messagePattern":"Only FeedRangeEpkImpl are supported\\. got: feedRange","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/azure-cosmos/src/main/java/org/apache/beam/sdk/io/azure/cosmos/NormalizedRange.java","lineNumber":54,"sourceCode":"\n  public static NormalizedRange fromFeedRange(FeedRange feedRange) {\n    if (feedRange instanceof FeedRangeEpkImpl) {\n      FeedRangeEpkImpl ekp = (FeedRangeEpkImpl) feedRange;\n      Range<String> range = ekp.getRange();\n      String min = range.getMin();\n      String max = range.getMax();\n\n      if (!range.isMinInclusive()) {\n        min = new BigInteger(min, 16).add(BigInteger.ONE).toString(16);\n      }\n\n      if (range.isMaxInclusive()) {\n        max = new BigInteger(max, 16).subtract(BigInteger.ONE).toString(16);\n      }\n\n      return new NormalizedRange(min, max);\n    } else {\n      throw new IllegalArgumentException(\"Only FeedRangeEpkImpl are supported. got: \" + feedRange);\n    }\n  }\n\n  public NormalizedRange(String minInclusive, String maxExclusive) {\n    this.minInclusive = minInclusive;\n    this.maxExclusive = maxExclusive;\n  }\n\n  public FeedRange toFeedRange() {\n    return new FeedRangeEpkImpl(new Range<>(minInclusive, maxExclusive, true, false));\n  }\n}\n","sourceCodeStart":36,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/azure-cosmos/src/main/java/org/apache/beam/sdk/io/azure/cosmos/NormalizedRange.java#L36-L67","documentation":"NormalizedRange.fromFeedRange only understands Azure Cosmos DB FeedRangeEpkImpl instances; any other FeedRange implementation is rejected with IllegalArgumentException('Only FeedRangeEpkImpl are supported. got: <feedRange>'). The connector can only partition by explicit EPK ranges.","triggerScenarios":"Passing a FeedRange that is not a FeedRangeEpkImpl (e.g., FeedRangePartitionKey or FeedRangePredicate) into NormalizedRange.fromFeedRange.","commonSituations":"Using partition-key-based feed ranges from the Cosmos SDK where the connector expects EPK string ranges, constructing feed ranges via SDK helpers that return other implementations, Cosmos SDK version changes.","solutions":["Use FeedRangeEpkImpl (explicit PK range strings) when configuring the Cosmos read.","Convert a FeedRangePartitionKey to its equivalent EPK range before passing it.","Check the Cosmos SDK version — ensure feed range construction matches what the connector supports.","Log/inspect the feedRange's class to confirm what implementation was supplied."],"exampleFix":"// before\nFeedRange range = FeedRange.forPartitionKey(new PartitionKey(\"pk\"));\nNormalizedRange.fromFeedRange(range);\n// after\nFeedRange range = new FeedRangeEpkImpl(new Range<String>(minHex, maxHex, true));\nNormalizedRange.fromFeedRange(range);","handlingStrategy":"type-guard","validationCode":"// verify the feed range implementation before passing it in\nif (!(feedRange instanceof FeedRangeEpkImpl)) {\n  throw new IllegalArgumentException(\"convert to FeedRangeEpkImpl first\");\n}","typeGuard":"boolean isEpkRange(FeedRange r) { return r instanceof FeedRangeEpkImpl; }","tryCatchPattern":"try {\n  NormalizedRange nr = NormalizedRange.fromFeedRange(feedRange);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Only FeedRangeEpkImpl\")) {\n    feedRange = toEpkRange(feedRange); // convert PartitionKey range to EPK range\n  }\n}","preventionTips":["Always construct FeedRangeEpkImpl for Cosmos connector reads","Convert partition-key feed ranges to EPK ranges explicitly","Pin a Cosmos SDK version compatible with the connector","Unit-test feed range construction for your query paths"],"tags":["azure-cosmos","feedrange","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}