Jump to content

SQLitePCL.pretty.SQLiteException when copying user with data (also statistics plugin not working)


Recommended Posts

Posted (edited)

Hello,

I have the following problem:
I create a new user and copy the user settings of a specific user (admin account) using the “User data” checkbox.

Spoiler

emby1.JPG.9f8d8aa36010dfcde0fdd113f21e4d47.JPG


This fails with the message
“Exception of type ‘SQLitePCL.pretty.SQLiteException’ was thrown.” 

Spoiler

emby2.JPG.43b682dfe55582756e02134cb1fb908a.JPG

It works without the “User data.” This is not a problem with other accounts.

I have already followed all the steps in the support article “Corrupt Database” and applied them to all 4 databases. All `integrity_checks` were `OK`. `VACUUM` and `REINDEX` also ran without errors.

I noticed the problem as follows: I use the Statistics plugin. Unfortunately, it doesn't seem to work for this user - since it's the (local) admin account, I thought it might be due to admin rights—so I wanted to simply copy the account without admin rights to view the statistics. However, that doesn't seem to be the cause. 

Unfortunately, the UserStats array of the request

http://192.168.xx.xx:8096/emby/Plugins/291d866f-baad-464a-aed6-a4a8b95a8fd7/Configuration?X-Emby-Client=Emby+Web&X-Emby-Device-Name=Chrome+Windows&X-Emby-Device-Id=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&X-Emby-Language=de

does not contain this user. I therefore suspect a problem in the data structure.

How can I solve the problem without having to recreate the user and lose all user statuses?

 

Here is my embyserver.txt: embyserver.txt

 

Thank you very much

Stueck

 

Edited by Stueck
Happy2Play
Posted

Looks like you tried to create the user and failed do to already existing then tried again and got sql error.

Spoiler

2026-02-05 14:49:24.067 Info UserService-0HNJ4NL49FEMH:00000005: http/1.1 POST http://host1:8096/emby/Users/New?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=cd6ecf6c-19aa-4a79-b9af-6061bf521f33&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=x_secret2_x&X-Emby-Language=de. Source Ip: host2, UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
2026-02-05 14:49:24.087 Error UserService-0HNJ4NL49FEMH:00000005: Error processing request
    *** Error Report ***
    Version: 4.9.3.0
    Command line: /opt/emby-server/system/EmbyServer.dll -programdata /mnt/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
    Operating system: Linux version 6.17.4-2-pve (build@proxmox) (gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44) #1 SMP PREEMPT_DYNAMIC PMX 6.17.4-2
    OS/Process: x64/x64
    Framework: .NET 8.0.22
    Runtime: opt/emby-server/system/System.Private.CoreLib.dll
    Processor count: 3
    Data path: /mnt/emby
    Application path: /opt/emby-server/system
    System.ArgumentException: System.ArgumentException: A user with the name 'test' already exists.
       at Emby.Server.Implementations.Library.UserManager.CreateUser(String name, UserPolicy userPolicy, UserConfiguration userConfiguration, Int64 copySettingsFromUserId, Int64 copyUserDataFromUserId)
       at Emby.Api.UserService.Post(CreateUserByName request)
       at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
       at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
       at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, RestPath restPath, String urlString, String localPath, String contentTypeInPath, CancellationToken cancellationToken)
    Source: Emby.Server.Implementations
    TargetSite: Void MoveNext()
    
2026-02-05 14:49:24.089 Info UserService-0HNJ4NL49FEMH:00000005: http/1.1 Response 400 to host2. Time: 22ms. POST http://host1:8096/emby/Users/New?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=cd6ecf6c-19aa-4a79-b9af-6061bf521f33&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=x_secret2_x&X-Emby-Language=de. 
2026-02-05 14:49:33.657 Info UserService-0HNJ4NL49FEMH:00000006: http/1.1 POST http://host1:8096/emby/Users/New?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=cd6ecf6c-19aa-4a79-b9af-6061bf521f33&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=x_secret2_x&X-Emby-Language=de. Source Ip: host2, UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
2026-02-05 14:49:33.730 Error UserService-0HNJ4NL49FEMH:00000006: Error processing request
    *** Error Report ***
    Version: 4.9.3.0
    Command line: /opt/emby-server/system/EmbyServer.dll -programdata /mnt/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
    Operating system: Linux version 6.17.4-2-pve (build@proxmox) (gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44) #1 SMP PREEMPT_DYNAMIC PMX 6.17.4-2
    OS/Process: x64/x64
    Framework: .NET 8.0.22
    Runtime: opt/emby-server/system/System.Private.CoreLib.dll
    Processor count: 3
    Data path: /mnt/emby
    Application path: /opt/emby-server/system
    SQLitePCL.pretty.SQLiteException: Constraint: FOREIGN KEY constraint failed
    SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
       at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
       at SQLitePCL.pretty.StatementImpl.MoveNext()
       at Emby.Server.Implementations.Data.SqliteUserDataRepository.CopyUserData(Int64 fromUserId, Int64 toUserId)
       at Emby.Server.Implementations.Library.UserDataManager.CopyUserData(Int64 fromUserId, Int64 toUserId)
       at Emby.Server.Implementations.Library.UserManager.CreateUser(String name, UserPolicy userPolicy, UserConfiguration userConfiguration, Int64 copySettingsFromUserId, Int64 copyUserDataFromUserId)
       at Emby.Api.UserService.Post(CreateUserByName request)
       at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
       at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
       at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, RestPath restPath, String urlString, String localPath, String contentTypeInPath, CancellationToken cancellationToken)
    Source: SQLitePCL.pretty
    TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)
    
2026-02-05 14:49:33.730 Info UserService-0HNJ4NL49FEMH:00000006: http/1.1 Response 500 to host2. Time: 73ms. POST http://host1:8096/emby/Users/New?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome Windows&X-Emby-Device-Id=cd6ecf6c-19aa-4a79-b9af-6061bf521f33&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=x_secret2_x&X-Emby-Language=de. 

 

Posted (edited)

Oh, the problem arose during testing. The problem still exists. Here is a new log.

 

I also ran further tests with other users. The error message also occurs sporadically here, but then works on another attempt. It only never works for this main user (he also has a lot of watched states, etc.).

 

embyserver (2).txt

Edited by Stueck
Posted
1 hour ago, Stueck said:

Oh, the problem arose during testing. The problem still exists. Here is a new log.

 

I also ran further tests with other users. The error message also occurs sporadically here, but then works on another attempt. It only never works for this main user (he also has a lot of watched states, etc.).

 

embyserver (2).txt 44.86 kB · 0 downloads

Hi, you are trying to create a new user with the same name as one that already exists. Try choosing a different user name.

Posted

No, I didn't do that in the last attempt. In this log (embyserver (2).txt), I specifically tested a name that has definitely never been used before: “kljhgfdsfghjgfdrtgzhbvgfdrtg”.

Happy2Play
Posted

Not sure how to reproduce this unless this is a platform specific issue as I just created a new user/w copy settings without issue.

2026-02-06 08:09:39.832 Debug Notifications: Sending notification to Activity Log Activity Log: New User Test Dummy Created on Main Media Server
2026-02-06 08:09:39.832 Info UserService-0HNJ2N3HB3T40:00000095: http/2 Response 200 to ‌‍‍xxx.xxx.xxx.xxx‌. Time: 262ms. POST https://‌‍‍my-emby.xxxxxxxxxxxxxxxxxx‌:1234/emby/Users/New?X-Emby-Client=Emby Web&X-Emby-Device-Name=Microsoft Edge Windows&X-Emby-Device-Id=4adf8204-81fa-4446-82c8-f5ffa6b5c79b&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=‌1234567890123456789012345678900‌&X-Emby-Language=en-us. 
2026-02-06 08:09:39.930 Info UserService-0HNJ2N3HB3T40:00000097: http/2 POST https://‌‍‍my-emby.xxxxxxxxxxxxxxxxxx‌:1234/emby/Users/59fcb9b97c264f108bcb4dc5f796aff6/Policy?X-Emby-Client=Emby Web&X-Emby-Device-Name=Microsoft Edge Windows&X-Emby-Device-Id=4adf8204-81fa-4446-82c8-f5ffa6b5c79b&X-Emby-Client-Version=4.9.3.0&X-Emby-Token=‌1234567890123456789012345678900‌&X-Emby-Language=en-us&reqformat=json. Source Ip: ‌‍‍xxx.xxx.xxx.xxx‌, UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145.0.0.0
2026-02-06 08:09:39.954 Debug XmlSerializer: Serializing to file A:\Emby-Server\config\users\59fcb9b97c264f108bcb4dc5f796aff6\policy.xml
2026-02-06 08:09:39.954 Debug Notifications: Sending notification to Activity Log Activity Log: User Policy Has Been Updated for Test Dummy on Main Media Server

 

Posted

Have you tried copying from other users?
 

Can I provide further information for better debugging?

Posted

Hi, we'll take a look at it. Thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...