# UserID - ActiveRecord::RecordNotFound

**URL:** https://community.zammad.org/t/userid-activerecord-recordnotfound/8716
**Category:** Technical assistance
**Created:** [February 20, 2022, 2:03pm UTC](https://community.zammad.org/t/userid-activerecord-recordnotfound/8716 "2022-02-20T14:03:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![7qubit](https://community.zammad.org/user_avatar/community.zammad.org/7qubit/32/5006_2.png) [@7qubit](https://community.zammad.org/u/7qubit)
#### Post date: [February 20, 2022, 2:03pm UTC](https://community.zammad.org/t/userid-activerecord-recordnotfound/8716/1 "2022-02-20T14:03:59Z")

</div>

### 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 ?

---

<div class="post-metadata">

### Author: ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)
#### Post date: [March 29, 2022, 9:48pm UTC](https://community.zammad.org/t/userid-activerecord-recordnotfound/8716/2 "2022-03-29T21:48:38Z")

</div>

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.
> 
> ```auto
> # 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](https://docs.zammad.org/en/latest/admin/console.html)

---

<div class="post-metadata">

### Author: ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)
#### Post date: [July 27, 2022, 9:49pm UTC](https://community.zammad.org/t/userid-activerecord-recordnotfound/8716/3 "2022-07-27T21:49:34Z")

</div>

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.
