The "Saved offset is not valid" error in Airbyte's MongoDB source connector is a common issue when syncing slow-moving tables, especially with limited oplog retention (e.g., 24 hours). This happens because the connector relies on MongoDB's oplog to track changes for incremental syncs. If there are no changes in the collection for a period longer than the oplog retention window, the resume token (offset) saved by Airbyte becomes invalid—MongoDB has already purged the relevant oplog entries, so the connector cannot resume from the last known position and fails with this error.
Key points from the knowledge sources: -
Oplog Retention Limitation: If your sync frequency is less than the oplog retention period, and there are no changes in the collection, the resume token can become invalid. This is especially problematic for slow-moving tables where changes are infrequent. The documentation explicitly states: > "Syncs that run less frequently than the retention period of the Oplog may encounter issues with missing data." > "When importing a large MongoDB collection for the first time, the import duration might exceed the Oplog retention period. The Oplog is crucial for incremental updates, and an invalid resume token will require the MongoDB collection to be re-imported to ensure no source updates were missed." [Troubleshooting MongoDB Sources](
https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations) -
Workarounds and Recommendations: -
Increase Oplog Retention: The most reliable solution is to increase the oplog size so it can retain changes for a longer period (ideally a week or more). However, this may not be feasible in all environments. -
Increase Sync Frequency: Run syncs more frequently than the oplog retention window, but as you noted, if there are no changes, this alone may not help. -
Ensure Data Movement: The connector needs at least one change in the collection within the oplog window to advance the resume token. If there are no changes, the offset will not advance, and the next sync may fail once the oplog recycles. > "Within that window, you need at least one successful sync that reads changes and advances the LSN. If the LSN does not advance before the oplog recycles, you can lose the position and the following sync will fail." [Github Issue #62833](
https://github.com/airbytehq/airbyte/issues/62833) -
Manual Workarounds: Some users have resorted to manually updating the resume token in the connection state, but this is not a sustainable or recommended solution for production. -
No Permanent Fix Yet: Even with recent connector updates (e.g., v2.0.4), users still report this issue for slow-moving tables, especially when the oplog window is not long enough to cover periods of inactivity. [Github Issue #62833](
https://github.com/airbytehq/airbyte/issues/62833)
Summary: For slow-moving tables, you must ensure that either: - The oplog retention is long enough to cover the longest period without changes in your collection,
or - There is at least one change in the collection within every oplog window (which may not be practical). Otherwise, the "Saved offset is not valid" error is likely to recur, and there is currently no built-in Airbyte solution to handle this scenario automatically. If you cannot increase the oplog retention or guarantee regular changes, you may need to periodically reset the connection and perform a full re-sync to avoid data loss. If you need more robust handling for slow-moving tables, you may want to follow ongoing Airbyte issues for updates or request a feature that better supports this use case.