Unable to edit profile in Mattermost

For feature requests, please see: https://mattermost.com/suggestions/.

For troubleshooting questions, please post in the following format:

Summary
Unable to edit user profile. Whenever try to edit it gives an error: “We encountered an error finding the account”

Steps to reproduce
How can we reproduce the issue (what version are you using?)
Mattermost server version 8.1.
Login to mattermost app and try changing anything in profile.

Expected behavior
Describe your issue in detail
It should change the profile.

Observed behavior
Get an error “We encountered an error finding the account”.
Any help in this case will be appreciated thanks in advance.

This is what i see in the logs:

{"timestamp":"2024-03-18 09:38:44.695 Z","level":"error","msg":"We encountered an error finding the account.","caller":"web/context.go:117","path":"/api/v4/users/me/patch","request_id":"1234567890","ip_addr":"127.0.0.1","user_id":"1234567890","method":"PUT","err_where":"UpdateUser","http_code":500,"error":"UpdateUser: We encountered an error finding the account., failed to get User with userId=1234567890: missing destination name lastlogin in *model.User"}```

How are you logging in? email/password, AD/LDAP, SAML, OpenID…

And 8.1 is EOL, you probably want to upgrade to 9.5 if you want to stay on ESR

https://docs.mattermost.com/upgrade/release-lifecycle.html

Hi, using email / password to login.
But is there any specific reason for the issue?
Also i have read on some github issue to check version in database using:

SELECT value FROM Systems WHERE name = 'Version';

And its output is 6.4.0 which is different from my installed version.
But if i check using mattermost version it gives me correct version i.e. 8.1.10.
Does it mean db migrations have some issue? If yes how can i fix it?

I will try to upgrade it as well.

I would suggest enable debug logging (EnableDebugging in config.json), tail the mattermost.log, and try to edit again. I’m guessing this will be a permissions issue of some sort.

I have checked mattermost.log file and this is what its showing when i try to change anything in profile.

error [2024-03-25 07:20:31.811 Z] We encountered an error finding the account.  caller="web/context.go:117" path=/api/v4/users/me/patch request_id=4bgaw51xj7dd3f3pngu4oyokrr ip_addr=1.2.3.4 user_id=mj6fkcxaxtba5da19sihidsb7o method=PUT err_where=UpdateUser http_code=500 error="UpdateUser: We encountered an error finding the account., failed to get User with userId=mj6fkcxaxtba5da19sihidsb7o: missing destination name lastlogin in *model.User"```

For anyone else facing this same issue. I would like to mention that the issue was in the database.
There was a column(lastlogin) which was creating issues. Deleting that column fixes the issue.