Skip to content

sqlite3.IntegrityError: NOT NULL constraint failed: playlog.userid #4629

@balloob

Description

@balloob

What version of Music Assistant has the issue?

2.8.0dev

How is the MA server installed?

Other - Please do not select this as support is only available for the above two options

Carefully read the Troubleshooting FAQ and confirm that

  • I have examined the logs and tried to resolve this issue
  • I have fixed any errors in the logs that relate to tags
  • I am not running MA across a VPN, VLAN, subnet, behind a firewall, or using local SSL or have any other complex network setup
  • I have disabled tool such as AdGuard, Pi-hole or pfSense and retested
  • I have checked my network setup to ensure mDNS/multicast is not being blocked
  • If using HA, I have confirmed the internal URL is set correctly
  • I have tried a wired connection for issues related to interrupted or poor playback quality
  • If the problem relates to a device then I have checked the device settings
  • If it is a frontend issue, I have tried a different widely used browser
  • I have reviewed the applicable player or music provider documentation
  • For voice problems, I have sought help elsewhere before returning here
  • For playback problems, I have recycled power to the physical device
  • I have tried restarting MA and rebooting the host

Have you reviewed the Open and Closed Issues and Discussions to resolve this yourself?

  • Yes

The problem

When running a dev version of MA, and I hit play from a sendspin client, I get the following error:

2025-12-24 17:02:49.569 INFO (MainThread) 
[music_assistant.player_queues] Fetching tracks to play for 
album Gold: Greatest Hits
2025-12-24 17:02:49.572 ERROR (MainThread) [music_assistant] 
Error doing task: Task exception was never retrieved
Traceback (most recent call last):
  File "/Users/paulus/dev/mass/server/music_assistant/controlle
rs/music.py", line 1190, in mark_item_played
    await self.database.insert(
    ...<3 lines>...
    )
  File "/Users/paulus/dev/mass/server/music_assistant/helpers/d
atabase.py", line 197, in insert
    row_id = await self._db.execute_insert(sql_query, values)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 193, in execute_insert
    return await self._execute(self._execute_insert, sql, 
parameters)
           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 122, in _execute
    return await future
           ^^^^^^^^^^^^
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 105, in run
    result = function()
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 78, in _execute_insert
    cursor = self._conn.execute(sql, parameters)
sqlite3.IntegrityError: NOT NULL constraint failed: 
playlog.userid

The reason is that Sendspin does not have a user attached to it, so there is no user to insert into the database.

A solution could be to let the Sendspin connection inherit the user ID that owns the queue it is listening to. But I don't know if that's correct and I wonder if the constraint should be part of the playlog?

How to reproduce

  • Open Music Assistant
  • Hit play from a sendspin player

Music Providers

Local filesystem

Player Providers

Sendspin

Full log output

2025-12-24 17:02:49.569 INFO (MainThread) 
[music_assistant.player_queues] Fetching tracks to play for 
album Gold: Greatest Hits
2025-12-24 17:02:49.572 ERROR (MainThread) [music_assistant] 
Error doing task: Task exception was never retrieved
Traceback (most recent call last):
  File "/Users/paulus/dev/mass/server/music_assistant/controlle
rs/music.py", line 1190, in mark_item_played
    await self.database.insert(
    ...<3 lines>...
    )
  File "/Users/paulus/dev/mass/server/music_assistant/helpers/d
atabase.py", line 197, in insert
    row_id = await self._db.execute_insert(sql_query, values)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 193, in execute_insert
    return await self._execute(self._execute_insert, sql, 
parameters)
           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 122, in _execute
    return await future
           ^^^^^^^^^^^^
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 105, in run
    result = function()
  File "/Users/paulus/dev/mass/server/.venv/lib/python3.13/site
-packages/aiosqlite/core.py", line 78, in _execute_insert
    cursor = self._conn.execute(sql, parameters)
sqlite3.IntegrityError: NOT NULL constraint failed: 
playlog.userid

Additional information

What version of Home Assistant Core (if used) are your running

None

What type of installation are you running?

Other - Please do not select this as support is only available for the above two options

On what type of hardware are you running?

macOS

Have you included ALL of the information specified in the Troubleshooting FAQ or explained why you cannot

  • Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions