{"record":{"id":"8fc15ed8d64dac34","repo":"Mintplex-Labs/anything-llm","slug":"mergeconnections-update-skipped-original-connec","errorCode":null,"errorMessage":"[mergeConnections] Update skipped: Original connection \"${originalDatabaseId}\" not found","messagePattern":"\\[mergeConnections\\] Update skipped: Original connection \"(.+?)\" not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/models/systemSettings.js","lineNumber":1184,"sourceCode":"      database_id,\n      originalDatabaseId,\n      connectionString,\n      engine,\n      schema,\n    } = update;\n\n    switch (action) {\n      case \"remove\": {\n        connectionsMap.delete(database_id);\n        break;\n      }\n      case \"update\": {\n        if (!connectionString) continue;\n        const newId = slugify(database_id);\n\n        // Verify original connection exists\n        if (!connectionsMap.has(originalDatabaseId)) {\n          console.warn(\n            `[mergeConnections] Update skipped: Original connection \"${originalDatabaseId}\" not found`\n          );\n          break;\n        }\n\n        // Check for name conflict (excluding the one being updated)\n        if (newId !== originalDatabaseId && connectionsMap.has(newId)) {\n          console.warn(\n            `[mergeConnections] Update skipped: New name \"${newId}\" conflicts with existing connection`\n          );\n          break;\n        }\n\n        // Remove old and add updated connection\n        connectionsMap.delete(originalDatabaseId);\n        connectionsMap.set(newId, {\n          engine,\n          database_id: newId,","sourceCodeStart":1166,"sourceCodeEnd":1202,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/models/systemSettings.js#L1166-L1202","documentation":"SystemSettings.mergeConnections received an 'update' action whose originalDatabaseId is not a key in the current connections map (the persisted vector-DB connection list), so that single update is skipped to avoid writing a bogus entry; the rest of the merge proceeds. The map is keyed by slugified connection ids.","triggerScenarios":"The connection was renamed or removed in an earlier merge pass, then an update referencing the old id arrives; slugify(database_id) produced a different id than the stored key; two concurrent config updates where one deleted the entry first; stale UI submitting an outdated connection id.","commonSituations":"Editing vector DB connections across multiple tabs/sessions; automation scripts updating by a name that was already renamed; leftover references after migrating connection ids.","solutions":["List the current connections (the env/system setting backing the map) and re-issue the update using the existing id.","If the goal is rename, ensure the original id still exists or recreate the connection under the new name.","Refresh the admin UI before editing so it submits current ids, not stale ones.","Avoid concurrent connection edits; serialize config changes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before submitting an update, confirm the original id still exists:\nconst current = await fetchConnectionsFromSettings();\nconst ids = new Set(current.map((c) => c.id));\nif (!ids.has(originalDatabaseId)) {\n  throw new Error(`connection \"${originalDatabaseId}\" no longer exists — refresh and retry`);\n}","typeGuard":"function connectionExists(connectionsMap, id) {\n  return typeof id === 'string' && connectionsMap.has(id);\n}","tryCatchPattern":null,"preventionTips":["Reload the connections list in the UI before editing to avoid stale ids.","Serialize connection edits — never merge concurrently.","When renaming, do the rename first, then update by the new id in a separate pass.","Log the surviving connection ids after each merge to catch drift early."],"tags":["vector-database","merge","stale-reference","system-settings"],"backgroundTag":"stale-reference-not-found","analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}