Added an existing user and all my managed users disappeared!?!?!?!?!

Plex pass with 3 managed users on my server.

So I want to share my library with my uncle but didn’t want to deal with having him call me with a pin every time he signs in to a new device. So I decided to see what the process was on adding an existing user by sending an invite to one of my alternate email addresses. The sign up process was easy and I was quickly signed in to my server using the new account.

However, when I logged in to the web interface with my primary account I found that all my managed users had disappeared. All that is available is the primary user… me. The only user is me. I can’t switch between users anymore because the other users don’t exist. All other users are gone! The new account is listed under friends on the users tab of the server web interface, but under users/my home, all there is is my account and “No one else is in your home. Add a user to enable user switching.”

WTF happened? Is all the info associated with those users gone? All the history gone? Is this normal behavior, and if so, WHY WOULDN’T YOU MAKE IT CLEAR THAT THIS WILL HAPPEN BEFORE ALLOWING SOMEONE TO DO THIS?!?!?!?!?

How do I fix this? Do I have to recreate these users? Can I use a backup DB to revert these changes? Am I not allowed to have existing users along with managed users, and if that’s the case, again, why the hell wouldn’t that be made perfectly clear?

I didn’t have time to wait for an answer so I searched some more. While it seems nobody has documented this issue in the past, my search did lead me to an answer.

This post,

contains a plex database management tool that I see as being invaluable for any serious Plex user. This tool gives sooo many options for manipulating different areas of your DB, including an easy to use watched status copy function that lets you copy watched status information from one user to another. This will even allow you to copy the watched status from a managed user to a full or invited user. Nice.

So what I did was create new managed users to replace the ones that were lost, then I used the DB tool to copy the watched status info from the old users to the new users. This worked perfectly.

I am wondering if I had simply recreated the old users verbatim, would the system automatically associate the new user with the old because they have the same name? Maybe. I’ll experiment with a backup DB tonight to find out and get back to you.

Check out that tool though. It’s worth it. Just make sure you backup your DB first.

@“Ted Phillips” said:
So I decided to see what the process was on adding an existing user by sending an invite to one of my alternate email addresses. The sign up process was easy and I was quickly signed in to my server using the new account.

Something is wrong with the above sentence.
If you want to share your server with someone outside your home, you don’t sign in your server into a newly created, different user account.

You don’t make any changes to your server, except creating the invite.
https://support.plex.tv/hc/en-us/sections/200295083-Server-Sharing

So maybe signed in is not the correct term, but something tells me you know what I’m talking about and are just being pedantic.

I signed in to plex.tv with the account info for the new user and pressed “launch”, that took me to app.plex.tv/web/app and i was… attached… is a better term maybe, to my plex server as the new user, as was expected.

Great! I thought. That was easy. So I went back to plex.tv, signed out of the new user account, then signed in to my regular user account, and pressed launch. Instead of being presented with all my users at the select user screen as per usual, I was only presented with the primary user. None of my managed users were there.

I went to the users screen in the web app, and saw my account under “My Home”, but my managed users were gone. The new user was listed under “Friends” though, so that worked.

So yeah, I invited a new user to share libraries on my server, and in doing so, somehow all my managed users were deleted.

@“Ted Phillips” said:
So maybe signed in is not the correct term, but something tells me you know what I’m talking about and are just being pedantic.

No, no pedanterie. It is important to do it right, otherwise you will indeed lose your Plex Home - as you’ve experienced.
Somehow I suspect that you not only did log out from the web browser app.
You did log out your server from your user account as well.

Your suspicions are incorrect.
Even when I connect directly , ie: “ip address:32400/web” my managed users were still gone.

Look, I did it right and it took a crap on me. If there is a way to do it that will cause things to be messed up in this way, then an extra dialog should be added to warn people. Considering there are no other people talking about this problem anywhere, I think it was just a glitch. If there was an incorrect way to do this that caused this to happen, then surely I wouldn’t be the first, and there would be others talking about it.

At any rate, I figured out a solution and detailed it in my second post. I’m out.

The exact same thing just happened to me. Added new plex acct user and my single managed user disappeared. The unfortunate part is that my managed user is my main account, with all of my watched statuses. Ted: does that info remain the in database and I can apply the watch statuses with the tool you mention to a new managed account?
Did you ever recreate the managed account with the same name/settings and see if it would come back to life? (i’m hesitant to do this before trying the first option; don’t want the new managed account, with the same name, to somehow wipe out the now orphaned data.)

It’s been a while since you asked, so you probably already know the answer, I’ll answer anyway for users who don’t know.
Yes, in my case the info for all the users I’ve ever had remains in the DB. The user info can be migrated to another user, managed or invited, using the tool I linked to. IIRC I created new managed users and copied status from the old user to the new

Well this just happened to me. What a dumb system to allow this to happen just because you’re account info is already cached on a browser, or worst yet, the server just ■■■■ the bed when adding a user! Thanks for the tips Ted, at least I know that I didn’t loose my F***ing mind. I hope that restoring the back up will resolve this…

Just got caught out with this too… really not happy. Livid in fact. Plex, where is the warning before executing? Or at least tell me to make a back up of my db first!

Something similar happened to me as well. I mean, gddmm*t Plex. Stop release features (webshows, really?) and instead start fixing these really basic bugs with already existing features.

Older thread but I thought I add to it for anyone else.

Awhile ago I accepted an invite to another Plex Home. The mistake was mine as I didn’t fully read the invite email that warned me of losing my current Home shares and users. Anyways I tried the fix reported in this thread but couldn’t get it to work. So here is what I did.

First I left the new Home I accepted. Then I recreated all my Home users. All of your previous Home user stats are still in the database but are inactive and unable to be reactivated iirc. So you need to swap the old with the new. Update all your old account_ids with the new. Here is how to do it.

First I found the old and new account_id:

old account_id
12345678 Me

new account_id
98765432 Me

Then I, made a copy of my database to work with and found the tables where these account_ids exist in the Plex database.

media_part_settings
metadata_item_settings
metadata_item_views
metadata_item_accounts
statistics_bandwidth
statistics_media

Then, using SQLite I ran the ran the following commands to update the database to use the new account_id for all the old entries.

UPDATE media_part_settings SET account_id = 98765432 WHERE account_id = 12345678;
UPDATE metadata_item_settings SET account_id = 98765432 WHERE account_id = 12345678;
UPDATE metadata_item_views SET account_id = 98765432 WHERE account_id = 12345678;
UPDATE metadata_item_accounts SET account_id = 98765432 WHERE account_id = 12345678;
UPDATE statistics_bandwidth SET account_id = 98765432 WHERE account_id = 12345678;
UPDATE statistics_media SET account_id = 98765432 WHERE account_id = 12345678;

I ran these commands for each of my Home account_ids. I then shutdown Plex and moved the updated db in place and started Plex again. All my users and stats, playlists, etc. were back.

Next step was for Tautulli. Same deal. Copy db and run the following for each account_id.

UPDATE session_history SET user_id = 98765432 WHERE user_id = 12345678;

Replace old db with modified. Restart Tautulli.

All my other users (Friends) were existent but without shares. So I used my plex_api_share.py to quickly bring everyone back to what they were shared. Even that was tedious so I updated that script to allow for backing up your users’ shares and restore those sharing settings from the backup file.

This is was a while ago so I maybe missing some parts of the process. But hopefully someone else may find this helpful.

8 Likes

So how and what do I do to get the said data you got from above? I don’t know where to go to get

old account_id
12345678 Me

new account_id
98765432 Me

stuff like that. Would you give me a walk through of how I can do this?

  • Get SQLite
  • Shutdown Plex
  • Make copy of DB
  • Open DB with SQLite
  • Go to the Browse Data tab
  • First table should be accounts, the id column is your account_id

You’ll need something like SQLite for changing the account_ids as described in the above post.

But you can also find your account_ids by using the /api/users or /api/home/users endpoints. You’ll need your Plex Token where it says {PLEX_TOKEN}.

All Users:
https://plex.tv/api/users?X-Plex-Token=1234abcde5689hjkl

Only Home Users:
https://plex.tv/api/home/users?X-Plex-Token=1234abcde5689hjkl

There you can view the all your users user_id which will be known in the DB as their account_id.

This saved my bacon last week when my Plex Home went on a permanent walk-about. Adding some of the commands I used in case they might help others in the same boat.

1. Get a valid Plex authentication token

curl -s -H 'x-plex-client-identifier: curl' --data-urlencode 'user[login]={YOUR-PLEX-EMAIL}' --data-urlencode 'user[password]={YOUR-PLEX-PASSWORD}' https://my.plexapp.com/users/sign_in.xml

Your {PLEX_TOKEN} is the value of the authentication-token element.

2. Get list of current managed home user account id values

curl -s -H 'x-plex-client-identifier: curl' https://plex.tv/api/home/users?X-Plex-Token={PLEX_TOKEN}`

Within each User element record the value of id and title as these are the user account id and user name respectively.

3. Get list of old user account values

Within the com.plexapp.plugins.library.db database you want the id and name values from the accounts table.

4. Associate new user account id’s with previous user play history and on-deck data

In the SQL below adjust the “INSERT INTO ua (new,old) VALUES” statement to match your environment. The value new is the id value recorded in step 2 while the old value would be the corresponding id value you recorded from step 3. Delete or add to match however many user accounts you need to recover.

Then execute it against the com.plexapp.plugins.library.db database.

CREATE TEMP TABLE ua (new INTEGER, old INTEGER);
INSERT INTO ua (new, old) VALUES
    (2######5,  6#####8), --User1
    (2######5,  6#####5), --User2
    (2######0,  6#####3), --User3
    (2######3,  6#####1), --User4
    (2######7,  6#####4), --User5
    (2######3,  2######8), --User6
    (2######0,  2######5); --User7

SELECT * FROM ua;

UPDATE view_settings SET account_id = (SELECT ua.new from ua WHERE view_settings.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE view_settings.account_id = ua.old);
UPDATE statistics_media SET account_id = (SELECT ua.new from ua WHERE statistics_media.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE statistics_media.account_id = ua.old);
UPDATE statistics_bandwidth SET account_id = (SELECT ua.new from ua WHERE statistics_bandwidth.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE statistics_bandwidth.account_id = ua.old);
UPDATE plugin_permissions SET account_id = (SELECT ua.new from ua WHERE plugin_permissions.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE plugin_permissions.account_id = ua.old);
UPDATE play_queues SET account_id = (SELECT ua.new from ua WHERE play_queues.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE play_queues.account_id = ua.old);
UPDATE metadata_item_views SET account_id = (SELECT ua.new from ua WHERE metadata_item_views.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE metadata_item_views.account_id = ua.old);
UPDATE metadata_item_settings SET account_id = (SELECT ua.new from ua WHERE metadata_item_settings.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE metadata_item_settings.account_id = ua.old);
UPDATE metadata_item_accounts SET account_id = (SELECT ua.new from ua WHERE metadata_item_accounts.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE metadata_item_accounts.account_id = ua.old);
UPDATE media_stream_settings SET account_id = (SELECT ua.new from ua WHERE media_stream_settings.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE media_stream_settings.account_id = ua.old);
UPDATE media_part_settings SET account_id = (SELECT ua.new from ua WHERE media_part_settings.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE media_part_settings.account_id = ua.old);
UPDATE media_item_settings SET account_id = (SELECT ua.new from ua WHERE media_item_settings.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE media_item_settings.account_id = ua.old);
UPDATE library_section_permissions SET account_id = (SELECT ua.new from ua WHERE library_section_permissions.account_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE library_section_permissions.account_id = ua.old);
UPDATE accounts SET id = (SELECT ua.new from ua WHERE accounts.id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE accounts.id = ua.old);

5. Associate Tautulli session play history to new user accounts

In the SQL below adjust the “INSERT INTO ua (new,old) VALUES” statement to match your environment. The value new is the id value recorded in step 2 while the old value would be the corresponding id value you recorded from step 3. Delete or add to match however many user accounts you need to recover.

Then execute it against the tautulli.db database.

CREATE TEMP TABLE ua (new INTEGER, old INTEGER);
INSERT INTO ua (new, old) VALUES
    (2######5,  6#####8), --User1
    (2######5,  6#####5), --User2
    (2######0,  6#####3), --User3
    (2######3,  6#####1), --User4
    (2######7,  6#####4), --User5
    (2######3,  2######8), --User6
    (2######0,  2######5); --User7

SELECT * FROM ua;

UPDATE notify_log SET user_id = (SELECT ua.new from ua WHERE notify_log.user_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE notify_log.user_id = ua.old);
UPDATE session_history SET user_id = (SELECT ua.new from ua WHERE session_history.user_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE session_history.user_id = ua.old);
UPDATE sessions SET user_id = (SELECT ua.new from ua WHERE sessions.user_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE sessions.user_id = ua.old);
UPDATE user_login SET user_id = (SELECT ua.new from ua WHERE user_login.user_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE user_login.user_id = ua.old);
UPDATE users SET user_id = (SELECT ua.new from ua WHERE users.user_id = ua.old) WHERE EXISTS (SELECT * FROM ua WHERE users.user_id = ua.old);
5 Likes

So I just subscribed to a Plex Pass for the explicit purpose of adding users so my family and friends can have their own preferences. I added 3 managed users and since one of my buddies already had their own Plex account(no plex pass) I added them as “existing user” …and the next day when they tried to accept my request it caused all my users to disappear …and they only show up now as a pending friend request under “sharing” which is not the tab I used to invite them. WTF? …this is nuts …that simply inviting someone could cause this kind of thing to happen? …I am now questioning whether I should have subscribed to plex pass if this is the kind problems I can expect!
Seriously? …this thread is 2 1/2 years old and this is not fixed yet?

That’s not what you did.
Apparently, you joined another user’s Plex Home.
Which will indeed cause your own Plex Home to get destroyed.
But you’ll see a stern warning displayed to you, when you attempt to do so. Blindly clicking through in this situation is very bad.

NopeI have never interacted with another plex user before now. The only thing that may have happen is that the person I invited was signed into my account when they accepted my invite …as I had loaned out use of my account before upgrading to Plex Pass …I assumed the popup they received required them to sign into their account? and not merely tried to add user to the account they were already signed into through an app/browser?

No warnings displayed to me anywhere.

Can I even join another user’s home without receiving an invite?

plex should completely disable letting a user that is the admin of a home, join another users home.

the user should have to manually disband their home, before being able to join some one else’s other home.

or, fix it so a remote user joining someone else home, doesn’t affect that remote user’s home.

1 Like

No, of course you cannot.
But you lending out your access credentials may indeed provide an explanation to this SNAFU. It may not even have been you who accepted the invitation and destroyed your Home in the process.