Jump to content

Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.


Recommended Posts

Micael456
Posted (edited)

Afternoon, hoping an API guru can help me here. I'm attempting to log on locally using a script user (would prefer this over an API key for scoping reasons). Unfortunately when the user attempts to log in I get a funky error thrown.

I know the issue is something to do with the way I'm calling this, as I have tested the account via the browser. I'm just not sure what obvious thing I'm missing. Any pointers would be appreciated.


This is what I'm posting:

Spoiler
curl --header "Content-Type: application/json" --header 'request: Authorization=Emby UserId="2c772b2cbdf249eb9cf5d16f4249636b", Client="Bash Script", Device="Linux OS", DeviceId="12345", Version="1.0.0.0" \
  --request POST \
  --data '{"Username":"localhost","password":"*****"}' \
  http://localhost:8096/Users/AuthenticateByName

 



And I'm fairly sure this is the relevant log section (though full log is attached):
 

Spoiler

 

2025-06-17 15:25:44.771 Info Server: http/1.1 POST http://localhost:8096/Users/AuthenticateByName. Source Ip: ::1, Accept=*/*, Host=host3, User-Agent=curl/7.58.0, Content-Type=application/json, Content-Length=52, request=Authorization=Emby UserId="2c772b2cbdf249eb9cf5d16f4249636b", Client="Bash Script", Device="Linux OS", DeviceId="12345", Version="1.0.0.0"
2025-06-17 15:25:44.773 Info UserManager: Authentication request for localhost has succeeded.
2025-06-17 15:25:44.773 Info SessionManager: Creating new access token for user 16 localhost
2025-06-17 15:25:44.774 Info App: Sqlite: 1299 - abort at 9 in [Insert Into Devices2 (ReportedDeviceId, ReportedName, IpAddress) Values (@ReportedDeviceId, @ReportedName, @IpAddress) returning Id]: NOT NULL constraint failed: Devices2.ReportedDeviceId
2025-06-17 15:25:44.781 Error Server: Error processing request
    *** Error Report ***
    Version: 4.8.11.0
    Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/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}_arm64.deb
    Operating system: Linux version 4.9.241-77 (root@builder_n2) (gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) ) #1 SMP PREEMPT Mon Mar 29 23:04:14 -03 2021
    Framework: .NET 6.0.36
    OS/Process: arm64/arm64
    Runtime: opt/emby-server/system/System.Private.CoreLib.dll
    Processor count: 6
    Data path: /var/lib/emby
    Application path: /opt/emby-server/system
    SQLitePCL.pretty.SQLiteException: Constraint: NOT NULL constraint failed: Devices2.ReportedDeviceId
    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.Sqlite.SqliteExtensions.ExecuteQuery(IStatement This)+MoveNext()
       at Emby.Server.Implementations.Security.AuthenticationRepository.GetDeviceId(Int64 internalId, String reportedDeviceId, String reportedDeviceName, IPAddress deviceIpAddress, Boolean checkForUpdatedDeviceValues, IDatabaseConnection db)
       at Emby.Server.Implementations.Security.AuthenticationRepository.Create(AuthenticationInfo info, IDatabaseConnection db, Boolean checkForUpdatedDeviceName)
       at Emby.Server.Implementations.Security.AuthenticationRepository.Create(AuthenticationInfo info)
       at Emby.Server.Implementations.Session.SessionManager.GetAuthorizationToken(User user, String reportedDeviceId, String app, String appVersion, String deviceName, IPAddress remoteIpAddress)
       at Emby.Server.Implementations.Session.SessionManager.AuthenticateNewSessionInternal(AuthenticationRequest request, Boolean enforcePassword, CancellationToken cancellationToken)
       at Emby.Api.UserService.Post(AuthenticateUserByName 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, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
    Source: SQLitePCL.pretty
    TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)
    
2025-06-17 15:25:44.892 Info Server: http/1.1 Response 500 to ::1. Time: 121ms. POST http://localhost:8096/Users/AuthenticateByName

Thank you!

Edit: realised I created this post in the wrong category, if a mod could move it. Sorry!

embyserver (26).txt

Edited by Micael456
Edited as I realised I made the post under client apps and not server Linux.
Posted

Hi, does this happen when trying to sign in with the Emby web app?

Micael456
Posted

No, this only happens when I try to call the API with curl. If I log in using the same credentials via chrome, I have no issues.

The curl version is below if that helps.

Spoiler
curl --version
curl 7.58.0 (aarch64-unknown-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

 

Cheers

Posted

Have you tried using the browser debugger to compare the request that the web app is sending to yours?

  • 3 weeks later...
Micael456
Posted

Sorry for the delay, unfortunately when I tried again in the browser it failed with the same error.

I'm also seeing that issue in the GUI when I'm trying to delete the user.

image.thumb.png.39f2ea18c4ff3cace8270f6437e740bf.png

Micael456
Posted (edited)

As a quick update- that might be a red herring right now. Looks like my root drive has completely filled up- 20GB of temp cache has appeared. I suspect at least some of today's issues are caused by that. Let me resolve this and see what the situation is afterwards.

Edited by Micael456
  • Thanks 1

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...