{"record":{"id":"2c4556b790e6afd5","repo":"apache/beam","slug":"rangetracker-for-type-start-position-not-implemented","errorCode":null,"errorMessage":"RangeTracker for {type(start_position)} not implemented!","messagePattern":"RangeTracker for (.+?) not implemented!","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/mongodbio.py","lineNumber":385,"sourceCode":"                      position of the source must be used.\n    Returns:\n      a ``_ObjectIdRangeTracker``, ``OffsetRangeTracker``\n      or ``LexicographicKeyRangeTracker`` depending on the given position range.\n    \"\"\"\n    start_position, stop_position = self._replace_none_positions(\n      start_position, stop_position\n    )\n\n    if isinstance(start_position, ObjectId):\n      return _ObjectIdRangeTracker(start_position, stop_position)\n\n    if isinstance(start_position, int):\n      return OffsetRangeTracker(start_position, stop_position)\n\n    if isinstance(start_position, str):\n      return LexicographicKeyRangeTracker(start_position, stop_position)\n\n    raise NotImplementedError(\n        f\"RangeTracker for {type(start_position)} not implemented!\")\n\n  def read(self, range_tracker):\n    \"\"\"Returns an iterator that reads data from the source.\n\n    The returned set of data must respect the boundaries defined by the given\n    ``RangeTracker`` object. For example:\n\n      * Returned set of data must be for the range\n        ``[range_tracker.start_position, range_tracker.stop_position)``. Note\n        that a source may decide to return records that start after\n        ``range_tracker.stop_position``. See documentation in class\n        ``RangeTracker`` for more details. Also, note that framework might\n        invoke ``range_tracker.try_split()`` to perform dynamic split\n        operations. range_tracker.stop_position may be updated\n        dynamically due to successful dynamic split operations.\n      * Method ``range_tracker.try_split()`` must be invoked for every record\n        that starts at a split point.","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/mongodbio.py#L367-L403","documentation":"_MongoSource.get_range_tracker only supports int positions (OffsetRangeTracker) or str positions (LexicographicKeyRangeTracker). Any other start_position type reaches a NotImplementedError stating that no RangeTracker exists for that type. It is an internal API surfaced when the source is used with unexpected position objects.","triggerScenarios":"Custom splitters/DoFns or other code calling get_range_tracker with a position that is neither int nor str (e.g. ObjectId, float, tuple) — typically from custom partitioning logic or a modified MongoDBIO read path.","commonSituations":"Porting code that used ObjectId-based positions in an older/custom mongodbio variant; passing floats from JSON-deserialized offsets; writing a custom range splitter that hands non-int positions.","solutions":["Pass start/stop positions as int (for offset-based reads) or str (for lexicographic _id reads).","Convert ObjectId positions to str via str(object_id) before requesting a range.","If float, cast to int; if None, leave positions unset so defaults are used.","If you truly need another position type, implement a custom RangeTracker and source instead of modifying mongodbio."],"exampleFix":"// before\nsource.get_range_tracker(object_id, None)\n// after\nsource.get_range_tracker(str(object_id), None)","handlingStrategy":"validation","validationCode":"assert start_position is None or isinstance(start_position, (int, str)), 'unsupported position type'","typeGuard":"def supported_position(v) -> bool:\n    return v is None or isinstance(v, (int, str)) and not isinstance(v, bool)","tryCatchPattern":"try:\n    rt = source.get_range_tracker(start, stop)\nexcept NotImplementedError:\n    rt = source.get_range_tracker(str(start), str(stop))","preventionTips":["Only pass int or str positions to mongodbio sources.","Convert ObjectId to str before range requests.","Don't build custom splitters that emit other position types."],"tags":["mongodb","range-tracker","not-implemented"],"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"}