-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug]: duplicate key value violates unique constraint "uid_chunk_id_idx" #121
Comments
the access update function takes care to ignore duplicate entries. I'm not entirely sure under what circumstances this error occurs. |
Here is a single document query with the error. NC server is on 192.168.0.73 Same setup as old context_chat_backend 3.x TRACE: 192.168.0.73:36906 - HTTP connection made The above exception was the direct cause of the following exception: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): --- Logging error --- During handling of the above exception, another exception occurred: Traceback (most recent call last): |
I am not sure if this is a bug or merely the way you are now avoiding duplicate embeddings.
It occurs on nearly every embedding run.
Message: 'Error adding documents to vectordb:'
Arguments: (IntegrityError('(psycopg.errors.UniqueViolation) duplicate key value violates unique constraint "uid_chunk_id_idx"
As can be seen from the following, the insert repeats multiple times for the same users.
I'm guessing - could this be due to multiple groups a user is member of having access to the same file?
Could a solution be to deduplicate UIDs for each file before the insert?
Arguments: (PendingRollbackError('This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (psycopg.errors.UniqueViolation) duplicate key value violates unique constraint "uid_chunk_id_idx"\n
DETAIL: Key (uid, source_id)=(4E3AE065-E8A4-4F30-ADCF-F8A4A67B6F3C, files__default: 7999141) already exists.\n[SQL: INSERT INTO access_list (uid, source_id) SELECT p0::VARCHAR, p1::VARCHAR FROM (VALUES (%(uid__0)s::VARCHAR, %(source_id__0)s::VARCHAR, 0), (%(uid__1)s::VARCHAR, %(source_id__1)s::VARCHAR, 1), (%(uid__2)s::VARCHAR, %(source_id__2)s::VARCHAR, 2), (%(ui ... 760 characters truncated ... imp_sen(p0, p1, sen_counter) ORDER BY sen_counter RETURNING access_list.id, access_list.id AS id__1]\n[parameters: {
'source_id__0': 'files__default: 7999141', 'uid__0': '0AE6C4F1-0254-406D-A94B-2BBAD5045A40',
'source_id__1': 'files__default: 7999141', 'uid__1': '473035F0-3947-434F-8F0E-A993E8712759',
'source_id__2': 'files__default: 7999141', 'uid__2': '4E3AE065-E8A4-4F30-ADCF-F8A4A67B6F3C',
'source_id__3': 'files__default: 7999141', 'uid__3': '4E3AE065-E8A4-4F30-ADCF-F8A4A67B6F3C',
'source_id__4': 'files__default: 7999141', 'uid__4': 'BFF7E4AF-2815-4F2D-9ADE-D39F2CB4CE4B',
'source_id__5': 'files__default: 7999141', 'uid__5': '94F1C9EA-8596-49E3-9E46-EF5C9D43E5B0',
'source_id__6': 'files__default: 7999141', 'uid__6': 'F69B0766-C729-421C-891F-F54448270B88',
'source_id__7': 'files__default: 7999141', 'uid__7': 'F69B0766-C729-421C-891F-F54448270B88',
'source_id__8': 'files__default: 7999141', 'uid__8': 'F69B0766-C729-421C-891F-F54448270B88',
'source_id__9': 'files__default: 7999141', 'uid__9': 'BFF7E4AF-2815-4F2D-9ADE-D39F2CB4CE4B',
'source_id__10': 'files__default: 7999141', 'uid__10': 'BFF7E4AF-2815-4F2D-9ADE-D39F2CB4CE4B',
'source_id__11': 'files__default: 7999141', 'uid__11': '8AECD92E-4670-4169-82C0-FB5BAB7C7D95',
'source_id__12': 'files__default: 7999141', 'uid__12': '5FFE2E1D-FA35-417F-9940-C200C1EEFA14',
'source_id__13': 'files__default: 7999141', 'uid__13': '306361B8-4B97-48A2-B703-53484C6CB60F',
'source_id__14': 'files__default: 7999141', 'uid__14': 'A7E93E83-91F6-45F8-9EB3-1F39D3AC5C3B',
'source_id__15': 'files__default: 7999141', 'uid__15': 'A53CAE5E-FC4B-45B4-85CD-9CC44CD4AE26',
'source_id__16': 'files__default: 7999141', 'uid__16': 'BEC630D0-ED32-475B-8AF7-80707404F643'}]
\n(Background on this error at: https://sqlalche.me/e/20/gkpj)'),)
[Nextcloud Hub 9] (30.0.1)
Nextcloud Assistant Context Chat 4.0.1
context_chat_backend 4.0.1
Remote AppAPI server
The text was updated successfully, but these errors were encountered: