<@U04S8PLJWMT> A sync was successful then I tried ...
# ask-ai
h
@kapa.ai A sync was successful then I tried syncing again and I received this error Saved offset is not valid. Please reset the connection, and then increase oplog retention and/or increase sync frequency to prevent his from happening in the future. See https://docs.airbyte.com/integrations/sources/mongodb-v2#mongodb-oplog-and-change-streams for more details
k
The error message: > Saved offset is not valid. Please reset the connection, and then increase oplog retention and/or increase sync frequency to prevent this from happening in the future. is a common issue when using Airbyte's MongoDB source connector. This error typically occurs when the resume token (offset) saved from a previous sync is no longer available in the MongoDB oplog. This can happen if: - The oplog retention period is too short, and the resume token has been purged from the oplog before the next sync. - There is insufficient data movement, so the oplog position (LSN) does not advance, and the token becomes stale. - The sync frequency is too low relative to the oplog retention period. Recommended actions: 1. Increase Oplog Retention/Size: Ensure your MongoDB oplog is large enough to retain changes for a longer period (ideally at least 24 hours, but a week is recommended for reliability). See [MongoDB Oplog and Change Streams](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations) for more details. 2. Increase Sync Frequency: Run syncs more frequently so that the saved offset is always within the current oplog window. 3. Ensure Data Movement: If there are long periods without changes in your collections, the resume token may not advance, increasing the risk of this error. Try to ensure there is at least some data movement between syncs. 4. Reset the Connection: If you encounter this error, you will need to reset the Airbyte connection to perform a full refresh, as the previous incremental position is no longer valid. This issue is well-documented and has been reported by multiple users, even with sufficient oplog size and frequent syncs. In some cases, bugs in earlier connector versions caused state management issues, but the fundamental cause is almost always related to oplog retention and sync frequency. If you are using a recent connector version and still encounter this, double-check your oplog window and sync schedule, and consider upgrading to the latest connector version if you haven't already, as some bugs have been fixed in newer releases [source-mongodb-v2 issue](https://github.com/airbytehq/airbyte/issues/62833), [troubleshooting docs](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations). For more details and troubleshooting steps, refer to the official documentation: [MongoDB Oplog and Change Streams](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations).
h
@kapa.ai I personally disabled some streams in the new sync
k
A message from kapa.ai
Disabling some streams in a new sync should not, by itself, cause the "Saved offset is not valid" error. However, the knowledge sources do not explicitly mention whether disabling streams can impact the state management or resume token handling in the MongoDB source connector. The error you encountered is primarily related to oplog retention, sync frequency, and the validity of the resume token, as described in the documentation and multiple user reports. There is no clear evidence in the provided sources that disabling streams would directly cause this error. If the state for a disabled stream is not updated or cleaned up properly, it could potentially lead to issues, but this is not confirmed in the available documentation or issue threads. If you continue to experience this error after disabling streams, it is most likely due to the usual oplog and sync frequency issues, not the act of disabling streams itself. If you suspect a bug related to stream disabling, consider reporting it with detailed logs and configuration to the Airbyte team for further investigation. In summary: There is no information in the knowledge sources indicating that disabling streams in a new sync directly causes the "Saved offset is not valid" error. The error remains primarily associated with oplog retention and sync frequency issues, not stream selection changes. If you need further assistance, please provide more details or consult the [official troubleshooting guide](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations).
h
@kapa.ai I retested and saved the source connector and it worked
k
A message from kapa.ai
Thank you for sharing your experience. Based on the knowledge sources, there is no explicit documentation or user report confirming that simply re-saving the source connector (without resetting the connection or changing other parameters) resolves the "Saved offset is not valid" error. Most guidance focuses on resetting the connection, increasing oplog retention, or increasing sync frequency as solutions to this issue. However, some users have reported that after making changes (such as updating the connector version or state), the sync worked again, but these actions typically involve more than just re-saving the connector configuration. The knowledge sources do not provide enough information to confirm that re-saving alone is a reliable or recommended fix for this error. If re-saving the source connector resolved the issue for you, that's a useful observation, but it is not documented as an official solution in the available sources. If the problem recurs, you may still need to follow the standard troubleshooting steps outlined in the documentation and issue threads, such as resetting the connection or adjusting oplog and sync settings [see example](https://github.com/airbytehq/airbyte/issues/62833).
h
@kapa.ai okay I still receive the error, what shall I do?
k
A message from kapa.ai
If you are still receiving the "Saved offset is not valid" error, here are the recommended steps based on the knowledge sources: 1. Reset the Connection: You must reset the Airbyte connection. This will perform a full refresh and re-establish a valid starting point for incremental syncs. This is necessary because the previous resume token (offset) is no longer valid and cannot be used for incremental syncs anymore [see example](https://github.com/airbytehq/airbyte/issues/46569). 2. Increase Oplog Retention/Size: Make sure your MongoDB oplog is large enough to retain changes for a longer period. The documentation recommends at least 24 hours, but a week is preferred for reliability. You can find instructions for adjusting oplog size in the [official docs](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations). 3. Increase Sync Frequency: Run your Airbyte syncs more frequently so that the saved offset is always within the current oplog window. If your syncs are less frequent than the oplog retention, you risk losing the resume token [see troubleshooting guide](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations). 4. Ensure Data Movement: If there are long periods without changes in your collections, the resume token may not advance, which can also cause this error. Try to ensure there is at least some data movement between syncs [source](https://github.com/airbytehq/airbyte/issues/62833). 5. Check User Permissions: Make sure the Airbyte MongoDB user has the correct permissions, especially
read
on the
local
database, so the connector can read oplog stats. Missing permissions can cause the connector to fall back to defaults and lead to issues [source](https://github.com/airbytehq/airbyte/issues/48496). 6. Upgrade the Connector: If you are not on the latest version of the MongoDB source connector, consider upgrading. Some bugs related to state management and resume tokens have been fixed in newer versions [source](https://github.com/airbytehq/airbyte/issues/46569). If you have already tried all of the above and the issue persists, please collect and share detailed logs with the Airbyte team, as there may be a connector bug or an edge case not covered in the documentation. For more details, refer to the [official troubleshooting guide](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations).
h
@kapa.ai why creating a new connection helped, I don't quite understand
k
A message from kapa.ai
Creating a new connection (or resetting the existing one) helps because it forces Airbyte to perform a full refresh instead of an incremental sync. This means Airbyte will ignore the previously saved offset (resume token) and start reading all data from scratch, establishing a new, valid starting point for future incremental syncs. The "Saved offset is not valid" error occurs when the previously saved resume token is no longer available in the MongoDB oplog—often because the oplog window has expired or the state has become inconsistent. By creating a new connection, Airbyte discards the old, invalid state and generates a new one, which resolves the error and allows syncs to proceed [see discussion](https://github.com/airbytehq/airbyte/issues/46569). The knowledge sources do not provide a deeper technical explanation beyond this, but the key point is: resetting or recreating the connection clears the invalid state and allows Airbyte to re-establish a valid sync position.