<@U04S8PLJWMT> I'm getting the below errors on sou...
# replication-ask-ai
i
@kapa.ai I'm getting the below errors on source connector when trying to sync 2 mongodb databases Caused by: io.debezium.DebeziumException: Unable to fetch change stream events followed by Caused by: com.mongodb.MongoCommandException: Command failed with error 51091 (Location51091): 'Regular expression is invalid: pattern string is longer than the limit set by the application' on server uae-preprod-1-shard-00-01-pri.7qnhs.mongodb.net:27017. The full response is {"ok": 0.0, "errmsg": "Regular expression is invalid: pattern string is longer than the limit set by the application", "code": 51091, "codeName": "Location51091", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1766475765, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "qMsO7nUnaQXTF9aeFj1PMM1odbs=", "subType": "00"}}, "keyId": 7521960372207616001}}, "operationTime": {"$timestamp": {"t": 1766475765, "i": 1}}}
k
The knowledge sources don’t mention this specific MongoDB error (
code 51091
, “Regular expression is invalid: pattern string is longer than the limit set by the application”), so I can’t give a definitive root cause from Airbyte’s side. I’ll outline what is documented and how it may relate, and where the gaps are. 1. MongoDB v2 uses change streams + Debezium for CDC Your first error (
io.debezium.DebeziumException: Unable to fetch change stream events
) is consistent with the connector failing while reading MongoDB change streams via Debezium. [[Replication methods](https://docs.airbyte.com/integrations/sources/mongodb-v2#replication-methods)] 2. Known CDC-related limitations focus on oplog / resume tokens, not regex The troubleshooting docs and related issues mainly cover: - Invalid / non‑resumable resume tokens when the oplog history is lost or too short. [[MongoDB troubleshooting](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations); [Issue 62833](https://github.com/airbytehq/airbyte/issues/62833); [Issue 70222](https://github.com/airbytehq/airbyte/issues/70222)] - Oplog size / retention and sync frequency recommendations. None of these mention MongoDB error
51091
or a regex length limit, so there is no explicit guidance in the docs for this exact failure. 3. Multiple databases support is new and potentially relevant You mention syncing two MongoDB databases. Multiple-database support was introduced in MongoDB v2 connector version
2.0.0
and requires using the new
databases
array field. [[Migration guide](https://docs.airbyte.com/integrations/sources/mongodb-v2-migrations#upgrading-to-200); [Changelog](https://docs.airbyte.com/integrations/sources/mongodb-v2#changelog)] However, the docs do not describe any known bug where using multiple databases causes an overly long regular expression or this specific MongoDB error. 4. **What we don’t have in the knowledge sources** - No mention of MongoDB error
51091
or “pattern string is longer than the limit set by the application”. - No description of Debezium or the MongoDB v2 connector building a regex that can exceed MongoDB’s internal limits. - No troubleshooting steps for this particular error. Because of that, I can’t reliably tell you from these sources whether this is: - A bug in the MongoDB v2 connector’s handling of multiple databases, - A Debezium configuration issue, - Or something specific to your MongoDB cluster configuration. --- Actionable next steps, given the documented material: 1. Confirm connector version and configuration style - Ensure you’re on MongoDB v2 ≥ 2.0.0 and using the
databases
array (not the old single
database
field) when syncing multiple DBs. [[Migration guide](https://docs.airbyte.com/integrations/sources/mongodb-v2-migrations#upgrading-to-200)] 2. Check general CDC prerequisites and limitations - Verify your cluster is a supported replica set / Atlas tier and meets the general limitations (no views, capped collections, etc.). [[Connector limitations](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] 3. If the error persists, this likely needs an issue report - Since this exact error is not documented, the safest path is to open a GitHub issue with: - Full connector version, - Exact source config (redacted credentials), - Whether it works with a single database but fails with two, - The full stack trace including the
51091
error. That will allow the Airbyte team to reproduce and, if needed, document or fix this behavior.
i
@kapa.ai I ebvounter it for the first time what should I do. with it ?
k
A message from kapa.ai
The knowledge sources don’t mention MongoDB error
51091
(“Regular expression is invalid: pattern string is longer than the limit set by the application”), so I can’t give a definitive, documented fix from the Airbyte side. I can only suggest next steps based on what is covered. Given that: 1. Confirm basic MongoDB v2 setup (especially with multiple databases) - Make sure you’re using the MongoDB v2 connector with the new
databases
array field if you’re syncing more than one database. [[MongoDB migration](https://docs.airbyte.com/integrations/sources/mongodb-v2-migrations#upgrading-to-200)] - Verify your cluster is a supported replica set / Atlas tier and meets the general connector limitations. [[Connector limitations](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations)] 2. Try to isolate the problem Since you see this when syncing 2 databases, try: - Configure a separate MongoDB source for each database (one DB per source) and run syncs independently. - If each database syncs fine alone but fails when combined, that’s strong evidence of a multi‑database–specific issue in the connector. 3. Collect logs and configuration details For the next step, you’ll want: - Full connector version (e.g.
source-mongodb-v2:2.x.x
). [[Changelog](https://docs.airbyte.com/integrations/sources/mongodb-v2#changelog)] - Your source configuration (with secrets redacted): connection string,
databases
list, any special read preferences, etc. - Full stack trace around
io.debezium.DebeziumException: Unable to fetch change stream events
and the
51091
error. 4. Open an Airbyte GitHub issue Because this specific regex error is not documented in the MongoDB v2 troubleshooting or existing issues, the recommended next step is to open a new issue on the Airbyte GitHub repo and include the details above. Existing MongoDB v2 issues focus on oplog / resume token problems, not regex length errors. [[MongoDB troubleshooting](https://docs.airbyte.com/integrations/sources/mongodb-v2/mongodb-v2-troubleshooting#connector-limitations); [Issue 62833](https://github.com/airbytehq/airbyte/issues/62833); [Issue 70222](https://github.com/airbytehq/airbyte/issues/70222)] In short: verify your multi‑DB configuration, test each DB separately, gather logs, and then report it as a potential connector bug, since the current docs and issues don’t cover this error.