UserID - ActiveRecord::RecordNotFound

Infos:

  • Used Zammad version: 5.0.3
  • Used Zammad installation type: Package
  • Operating system: Ubuntu
  • Browser + version: Firefox 97

Expected behavior:

  • A user gets when logging in, error message that : Couldn’t find User with ‘id’=14844

My authentication is done via LDAP. on Production log it can be seen that user “Marc Y” has successfully authenticated, but his user ID is not found.

Search for this UserID has no result (rails c). However, user “Marc Y” still exists but has a different UserID.

When I click in Admin area on Userview of “Marc Y” I get only a white page.

[2022-02-29T14:06:36.586091 #1622-1468720] ERROR – : Couldn’t find User with ‘id’=14844 (ActiveRecord::RecordNotFound)

Actual behavior:

  • User “Marc Y” is currently unable to log in. Although it already exists but has a different user ID.

Why does zammad look at “Marc Y” for a UserID for login that does not exist ?
and how can I correct these errors ?

Looks like your ExternalSync table got out of sync with your user table.
This usually shouldn’t (can’t™️) happen.

I’m guessing you fiddled around, this is a very dangerous thing.

Dangerzone

Warning - this solution is USER and INSTANCE SPECIFIC - dear copy cats, continue at own risk.
BELOW OPERATION IS TECHNICALLY VERY DANGEROUS, HAVE A BACKUP.

# Find the ExternalSync holding the missing user id
ExternalSync.where(source: 'Ldap::User', o_id: 13982).ids

# Should have returned one id
ExternalSync.find(<returned id>).destroy

This should solve the issue. Again, use at your own risk - I have not verified or tested this in any way.
This documentation page will also tell you how to run rails commands: Console — Zammad documentation