[GH-ISSUE #214] [Bug]: Adding scripts from HA and problems deleting printers #133

Closed
opened 2026-05-06 12:26:11 +02:00 by BreizhHardware · 12 comments

Originally created by @IROKILLER on GitHub (Feb 1, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/214

Originally assigned to: @maziggy on GitHub.

Bug Description

I tried to see if the new version's feature that allows you to bind multiple Home Assistant scripts to the printer worked. You can add multiple scripts to Bambuddy, but you can only bind one to the printer at a time. Therefore, I tried to remove the printer and found that Bambuddy completely froze, requiring a full restart.

Expected Behavior

That the function works as I tested it in feature/176

Steps to Reproduce

HA Problem
Settings - Smart Plug - +Add Smart Plug - HA - Script entity input - Link to Printer

Printer
Printer - the 3 dots in the upper right - Delete

Printer Model

A1

Bambuddy Version

0.1.6

Printer Firmware Version

01.07.02.00

Installation Method

Docker

Operating System

Docker

Relevant Logs / Support Package

bambuddy-support-20260201-121018.zip

Screenshots

from the current version
Image

from yesterday's tested version

Image

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this bug hasn't already been reported
  • I am using the latest version of Bambuddy
  • My printer is set to LAN Only mode
Originally created by @IROKILLER on GitHub (Feb 1, 2026). Original GitHub issue: https://github.com/maziggy/bambuddy/issues/214 Originally assigned to: @maziggy on GitHub. ### Bug Description I tried to see if the new version's feature that allows you to bind multiple Home Assistant scripts to the printer worked. You can add multiple scripts to Bambuddy, but you can only bind one to the printer at a time. Therefore, I tried to remove the printer and found that Bambuddy completely froze, requiring a full restart. ### Expected Behavior That the function works as I tested it in feature/176 ### Steps to Reproduce HA Problem Settings - Smart Plug - +Add Smart Plug - HA - Script entity input - Link to Printer Printer Printer - the 3 dots in the upper right - Delete ### Printer Model A1 ### Bambuddy Version 0.1.6 ### Printer Firmware Version 01.07.02.00 ### Installation Method Docker ### Operating System Docker ### Relevant Logs / Support Package [bambuddy-support-20260201-121018.zip](https://github.com/user-attachments/files/24992151/bambuddy-support-20260201-121018.zip) ### Screenshots from the current version <img width="1774" height="1029" alt="Image" src="https://github.com/user-attachments/assets/2851475c-5c93-43f3-8fbc-ba5afbe84b05" /> from yesterday's tested version <img width="577" height="760" alt="Image" src="https://github.com/user-attachments/assets/d43d2137-9902-4656-88b4-c79a1916117b" /> ### Additional Context _No response_ ### Checklist - [x] I have searched existing issues to ensure this bug hasn't already been reported - [x] I am using the latest version of Bambuddy - [x] My printer is set to LAN Only mode
BreizhHardware 2026-05-06 12:26:11 +02:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@maziggy commented on GitHub (Feb 1, 2026):

Fixed in branch 0.1.7b. Please check and let me know. Thanks!!!

<!-- gh-comment-id:3831071867 --> @maziggy commented on GitHub (Feb 1, 2026): Fixed in branch 0.1.7b. Please check and let me know. Thanks!!!
Author
Owner

@IROKILLER commented on GitHub (Feb 2, 2026):

Deleting the printer is possible, but assigning the HA script is only possible once.

Image

after the update from 0.1.6.2

<!-- gh-comment-id:3837398146 --> @IROKILLER commented on GitHub (Feb 2, 2026): Deleting the printer is possible, but assigning the HA script is only possible once. ![Image](https://github.com/user-attachments/assets/c9057c78-a5bf-4dd2-adcb-aa368398b2e1) after the update from 0.1.6.2
Author
Owner

@maziggy commented on GitHub (Feb 3, 2026):

This was not merged into the last release :(

Fixed in branch 0.1.7b. Please let me know if it works.

<!-- gh-comment-id:3839743217 --> @maziggy commented on GitHub (Feb 3, 2026): This was not merged into the last release :( Fixed in branch 0.1.7b. Please let me know if it works.
Author
Owner

@IROKILLER commented on GitHub (Feb 3, 2026):

HAScript is throwing a new error. And unfortunately, deleting the printer is no longer possible either.

bambuddy-support-20260203-150924.zip

Image
<!-- gh-comment-id:3841925929 --> @IROKILLER commented on GitHub (Feb 3, 2026): HAScript is throwing a new error. And unfortunately, deleting the printer is no longer possible either. [bambuddy-support-20260203-150924.zip](https://github.com/user-attachments/files/25049764/bambuddy-support-20260203-150924.zip) <img width="511" height="862" alt="Image" src="https://github.com/user-attachments/assets/8fc85287-f283-49d0-b83c-2559829c834e" />
Author
Owner

@maziggy commented on GitHub (Feb 3, 2026):

Use just release version. There are some fixes which unfortunately didn't make it to te former release.

<!-- gh-comment-id:3842029242 --> @maziggy commented on GitHub (Feb 3, 2026): Use just release version. There are some fixes which unfortunately didn't make it to te former release.
Author
Owner

@IROKILLER commented on GitHub (Feb 3, 2026):

I'm using version 0.1.7

<!-- gh-comment-id:3842044408 --> @IROKILLER commented on GitHub (Feb 3, 2026): I'm using version 0.1.7
Author
Owner

@maziggy commented on GitHub (Feb 3, 2026):

Cannot reproduce. There are also no erros in your log files.

<!-- gh-comment-id:3842133452 --> @maziggy commented on GitHub (Feb 3, 2026): Cannot reproduce. There are also no erros in your log files.
Author
Owner

@IROKILLER commented on GitHub (Feb 3, 2026):

I can see this in the Unraid log. Oddly enough, it's not in the Bambuddy.log file.

`INFO: 192.168.178.48:61598 - "PATCH /api/v1/smart-plugs/2 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
~~~~~~~~~~~~~~~~~~~~~~~^
cursor, str_statement, effective_parameters, context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
cursor.execute(statement, parameters)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 182, in execute
self._adapt_connection._handle_exception(error)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 342, in handle_exception
raise error
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 164, in execute
self.await
(_cursor.execute(operation, parameters))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only
return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 40, in execute
await self._execute(self._cursor.execute, sql, parameters)
File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 32, in _execute
return await self._conn._execute(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 160, in _execute
return await future
^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 63, in _connection_worker_thread
result = function()
sqlite3.IntegrityError: UNIQUE constraint failed: smart_plugs.printer_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py", line 416, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.scope, self.receive, self.send
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/contextlib.py", line 162, in exit
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.13/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 193, in call
response = await self.dispatch_func(request, call_next)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/app/main.py", line 2700, in auth_middleware
return await call_next(request)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 168, in call_next
raise app_exc from app_exc.cause or app_exc.context
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 144, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/usr/local/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 63, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 716, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 736, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 290, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 115, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 101, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 355, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 243, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/app/api/routes/smart_plugs.py", line 461, in update_smart_plug
await db.commit()
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/ext/asyncio/session.py", line 1000, in commit
await greenlet_spawn(self.sync_session.commit)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 203, in greenlet_spawn
result = context.switch(value)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2030, in commit
trans.commit(_to_root=True)
~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "", line 2, in commit
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go
ret_value = fn(self, *arg, **kw)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 1311, in commit
self._prepare_impl()
~~~~~~~~~~~~~~~~~~^^
File "", line 2, in _prepare_impl
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go
ret_value = fn(self, *arg, **kw)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 1286, in _prepare_impl
self.session.flush()
~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 4331, in flush
self._flush(objects)
~~~~~~~~~~~^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 4466, in _flush
with util.safe_reraise():
~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 224, in exit
raise exc_value.with_traceback(exc_tb)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 4427, in _flush
flush_context.execute()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
rec.execute(self)
~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
util.preloaded.orm_persistence.save_obj(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self.mapper,
^^^^^^^^^^^^
uow.states_for_mapper_hierarchy(self.mapper, False, False),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uow,
^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj
_emit_update_statements(
~~~~~~~~~~~~~~~~~~~~~~~^
base_mapper,
^^^^^^^^^^^^
...<3 lines>...
update,
^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/persistence.py", line 912, in _emit_update_statements
c = connection.execute(
statement, multiparams, execution_options=execution_options
)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
self,
distilled_parameters,
execution_options or NO_OPTIONS,
)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 527, in _execute_on_connection
return connection._execute_clauseelement(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self, distilled_params, execution_options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
dialect,
...<8 lines>...
cache_hit=cache_hit,
)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
~~~~~~~~~~~~~~~~~~~~~~~~~^
dialect, context, statement, parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
e, str_statement, effective_parameters, cursor, context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
~~~~~~~~~~~~~~~~~~~~~~~^
cursor, str_statement, effective_parameters, context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
cursor.execute(statement, parameters)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 182, in execute
self._adapt_connection._handle_exception(error)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 342, in handle_exception
raise error
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 164, in execute
self.await
(_cursor.execute(operation, parameters))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only
return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
value = await result
^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 40, in execute
await self._execute(self._cursor.execute, sql, parameters)
File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 32, in _execute
return await self._conn._execute(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 160, in _execute
return await future
^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 63, in _connection_worker_thread
result = function()
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: smart_plugs.printer_id
[SQL: UPDATE smart_plugs SET printer_id=?, updated_at=CURRENT_TIMESTAMP WHERE smart_plugs.id = ?]
[parameters: (1, 2)]
(Background on this error at: https://sqlalche.me/e/20/gkpj)`

<!-- gh-comment-id:3842193056 --> @IROKILLER commented on GitHub (Feb 3, 2026): I can see this in the Unraid log. Oddly enough, it's not in the Bambuddy.log file. `INFO: 192.168.178.48:61598 - "PATCH /api/v1/smart-plugs/2 HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( ~~~~~~~~~~~~~~~~~~~~~~~^ cursor, str_statement, effective_parameters, context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute cursor.execute(statement, parameters) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 182, in execute self._adapt_connection._handle_exception(error) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 342, in _handle_exception raise error File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 164, in execute self.await_(_cursor.execute(operation, parameters)) ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn value = await result ^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 40, in execute await self._execute(self._cursor.execute, sql, parameters) File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 32, in _execute return await self._conn._execute(fn, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 160, in _execute return await future ^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 63, in _connection_worker_thread result = function() sqlite3.IntegrityError: UNIQUE constraint failed: smart_plugs.printer_id The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py", line 416, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ self.scope, self.receive, self.send ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/fastapi/applications.py", line 1135, in __call__ await super().__call__(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/applications.py", line 107, in __call__ await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/usr/local/lib/python3.13/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 191, in __call__ with recv_stream, send_stream, collapse_excgroups(): ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__ self.gen.throw(value) ~~~~~~~~~~~~~~^^^^^^^ File "/usr/local/lib/python3.13/site-packages/starlette/_utils.py", line 85, in collapse_excgroups raise exc File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 193, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/app/main.py", line 2700, in auth_middleware return await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 168, in call_next raise app_exc from app_exc.__cause__ or app_exc.__context__ File "/usr/local/lib/python3.13/site-packages/starlette/middleware/base.py", line 144, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/usr/local/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 63, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app raise exc File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__ await self.app(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 716, in __call__ await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 736, in app await route.handle(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/routing.py", line 290, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 115, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app raise exc File "/usr/local/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 101, in app response = await f(request) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 355, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... ) ^ File "/usr/local/lib/python3.13/site-packages/fastapi/routing.py", line 243, in run_endpoint_function return await dependant.call(**values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/app/api/routes/smart_plugs.py", line 461, in update_smart_plug await db.commit() File "/usr/local/lib/python3.13/site-packages/sqlalchemy/ext/asyncio/session.py", line 1000, in commit await greenlet_spawn(self.sync_session.commit) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 203, in greenlet_spawn result = context.switch(value) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2030, in commit trans.commit(_to_root=True) ~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "<string>", line 2, in commit File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go ret_value = fn(self, *arg, **kw) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 1311, in commit self._prepare_impl() ~~~~~~~~~~~~~~~~~~^^ File "<string>", line 2, in _prepare_impl File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/state_changes.py", line 137, in _go ret_value = fn(self, *arg, **kw) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 1286, in _prepare_impl self.session.flush() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 4331, in flush self._flush(objects) ~~~~~~~~~~~^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 4466, in _flush with util.safe_reraise(): ~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 224, in __exit__ raise exc_value.with_traceback(exc_tb) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 4427, in _flush flush_context.execute() ~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute rec.execute(self) ~~~~~~~~~~~^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute util.preloaded.orm_persistence.save_obj( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self.mapper, ^^^^^^^^^^^^ uow.states_for_mapper_hierarchy(self.mapper, False, False), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ uow, ^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj _emit_update_statements( ~~~~~~~~~~~~~~~~~~~~~~~^ base_mapper, ^^^^^^^^^^^^ ...<3 lines>... update, ^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/orm/persistence.py", line 912, in _emit_update_statements c = connection.execute( statement, multiparams, execution_options=execution_options ) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1419, in execute return meth( self, distilled_parameters, execution_options or NO_OPTIONS, ) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 527, in _execute_on_connection return connection._execute_clauseelement( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self, distilled_params, execution_options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement ret = self._execute_context( dialect, ...<8 lines>... cache_hit=cache_hit, ) File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( ~~~~~~~~~~~~~~~~~~~~~~~~~^ dialect, context, statement, parameters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ e, str_statement, effective_parameters, cursor, context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( ~~~~~~~~~~~~~~~~~~~~~~~^ cursor, str_statement, effective_parameters, context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute cursor.execute(statement, parameters) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 182, in execute self._adapt_connection._handle_exception(error) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 342, in _handle_exception raise error File "/usr/local/lib/python3.13/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 164, in execute self.await_(_cursor.execute(operation, parameters)) ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn value = await result ^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 40, in execute await self._execute(self._cursor.execute, sql, parameters) File "/usr/local/lib/python3.13/site-packages/aiosqlite/cursor.py", line 32, in _execute return await self._conn._execute(fn, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 160, in _execute return await future ^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiosqlite/core.py", line 63, in _connection_worker_thread result = function() sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: smart_plugs.printer_id [SQL: UPDATE smart_plugs SET printer_id=?, updated_at=CURRENT_TIMESTAMP WHERE smart_plugs.id = ?] [parameters: (1, 2)] (Background on this error at: https://sqlalche.me/e/20/gkpj)`
Author
Owner

@maziggy commented on GitHub (Feb 3, 2026):

Did you restart the container after uograding? Looks like the database migration hasn't run.

<!-- gh-comment-id:3842203001 --> @maziggy commented on GitHub (Feb 3, 2026): Did you restart the container after uograding? Looks like the database migration hasn't run.
Author
Owner

@IROKILLER commented on GitHub (Feb 3, 2026):

Unraid actually does that on its own after the update. But yes, I did turn it off again, wait a short while, and then restart it.

<!-- gh-comment-id:3842226080 --> @IROKILLER commented on GitHub (Feb 3, 2026): Unraid actually does that on its own after the update. But yes, I did turn it off again, wait a short while, and then restart it.
Author
Owner

@IROKILLER commented on GitHub (Feb 3, 2026):

Either something must have gone wrong with the entire update, but I completely reinstalled everything and now it works.

<!-- gh-comment-id:3842424421 --> @IROKILLER commented on GitHub (Feb 3, 2026): Either something must have gone wrong with the entire update, but I completely reinstalled everything and now it works.
Author
Owner

@maziggy commented on GitHub (Feb 3, 2026):

I don't know Unraid at all. Glad it works again for you!

<!-- gh-comment-id:3842491020 --> @maziggy commented on GitHub (Feb 3, 2026): I don't know Unraid at all. Glad it works again for you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy#133
No description provided.