🐛 Bug Report: Error syncing LDAP groups - invalid input syntax for type uuid (SQLSTATE 22P02) #327

Closed
opened 2025-10-08 00:03:31 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @user00265 on GitHub.

Reproduction steps

I have LDAP configured and syncing mostly everything. If I remove all LDAP users and groups and sync, it will not display an error. Any syncs after that, however will throw an error on the log.

Part of the issue seems to be it is trying to do something with a local user that does not exist in LDAP who happens to have an empty uuid in the database.

The database backend is PostgreSQL.

Expected behavior

It should successfully sync.

Actual Behavior

Succeeds on initial sync, displays "Something went wrong" on any attempts to sync afterwards.

Version and Environment

v0.35.2

Log Output

2025/02/25 02:13:28 Error syncing group _app_admins: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02)
2025/02/25 02:13:28 /app/backend/internal/service/user_group_service.go:115 ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02)
[0.581ms] [rows:0] SELECT * FROM "users" WHERE id IN ($1$,$2$,$3$)
[GIN] 2025/02/25 - 02:13:28 | 500 |  612.914482ms |   172.16.20.131 | POST     "/api/application-configuration/sync-ldap"
Error #01: failed to sync groups: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02)
[GIN] 2025/02/25 - 02:13:28 | 500 |  612.947605ms |   172.16.20.131 | POST     "/api/application-configuration/sync-ldap"
Error #01: failed to sync groups: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02)
Originally created by @user00265 on GitHub. ### Reproduction steps I have LDAP configured and syncing mostly everything. If I remove all LDAP users and groups and sync, it will not display an error. Any syncs after that, however will throw an error on the log. Part of the issue seems to be it is trying to do something with a local user that does not exist in LDAP who happens to have an empty uuid in the database. The database backend is PostgreSQL. ### Expected behavior It should successfully sync. ### Actual Behavior Succeeds on initial sync, displays "Something went wrong" on any attempts to sync afterwards. ### Version and Environment `v0.35.2` ### Log Output ``` 2025/02/25 02:13:28 Error syncing group _app_admins: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02) 2025/02/25 02:13:28 /app/backend/internal/service/user_group_service.go:115 ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02) [0.581ms] [rows:0] SELECT * FROM "users" WHERE id IN ($1$,$2$,$3$) [GIN] 2025/02/25 - 02:13:28 | 500 | 612.914482ms | 172.16.20.131 | POST "/api/application-configuration/sync-ldap" Error #01: failed to sync groups: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02) [GIN] 2025/02/25 - 02:13:28 | 500 | 612.947605ms | 172.16.20.131 | POST "/api/application-configuration/sync-ldap" Error #01: failed to sync groups: ERROR: invalid input syntax for type uuid: "" (SQLSTATE 22P02) ```
OVERLORD added the bug label 2025-10-08 00:03:31 +03:00
Author
Owner

@stonith404 commented on GitHub:

Thanks for your detailed explanation, this should be fixed in 0.35.3.

@stonith404 commented on GitHub: Thanks for your detailed explanation, this should be fixed in `0.35.3`.
Author
Owner

@user00265 commented on GitHub:

To be specific:

  • The user was the default admin user
  • The account was renamed to a specific name
  • When LDAP was added to sync later on, there was a user with the same name and I had assumed it would just add the UUID and track it and not conflict... I know this is not the case now.
  • After discovering the above, I renamed the local user to a name that does not exist in LDAP
  • After this, I've been getting this issue

So to answer your question, the user is the default admin local user, which had been using a name that eventually conflicted with LDAP users. This has been cleared, LDAP was disabled, users were removed, and LDAP re-enabled and re-synced.

The database shows 3 users, which is correct. 2 from LDAP and 1 from the local account. The conflicting user show NULL as the value for the ldap_id column.

@user00265 commented on GitHub: To be specific: * The user was the default admin user * The account was renamed to a specific name * When LDAP was added to sync later on, there was a user with the same name and I had assumed it would just add the UUID and track it and not conflict... I know this is not the case now. * After discovering the above, I renamed the local user to a name that does not exist in LDAP * After this, I've been getting this issue So to answer your question, the user is the default admin local user, which had been using a name that eventually conflicted with LDAP users. This has been cleared, LDAP was disabled, users were removed, and LDAP re-enabled and re-synced. The database shows 3 users, which is correct. 2 from LDAP and 1 from the local account. The conflicting user show NULL as the value for the `ldap_id` column.
Author
Owner

@stonith404 commented on GitHub:

Could it be that you have a non LDAP user in the Pocket ID database that has the same username as a user on your LDAP server?

@stonith404 commented on GitHub: Could it be that you have a non LDAP user in the Pocket ID database that has the same username as a user on your LDAP server?
Author
Owner

@stonith404 commented on GitHub:

Thanks for reporting this.

So there is an user in the database that has an empty uuid? Is anything special about this user? For example can you remember that you've tried to delete this user or did you update it manually in the database?

Also do the other columns of the user look correct or has he also for example an empty username, email or name?

@stonith404 commented on GitHub: Thanks for reporting this. So there is an user in the database that has an empty uuid? Is anything special about this user? For example can you remember that you've tried to delete this user or did you update it manually in the database? Also do the other columns of the user look correct or has he also for example an empty username, email or name?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id-pocket-id-1#327