jlvcm / ha-actualbudget

Actual Budget integration for Home Assistant
14 stars 2 forks source link

sqlite3.IntegrityError: UNIQUE constraint failed: dashboard.id #4

Open bambamalicious opened 2 days ago

bambamalicious commented 2 days ago

Hey man, great start and would love to use this with my local hosted instance.

Am hosting Actual in a docker container, through reverse proxy with SSL cert. Attempting to connect using SKIP provides the following error in HA;

Log Details (ERROR)
Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:433
First occurred: 17:15:47 (2 occurrences)
Last logged: 17:19:46

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 366, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 413, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/actualbudget/config_flow.py", line 67, in async_step_user
    error = await self._test_connection(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/actualbudget/config_flow.py", line 83, in _test_connection
    return await api.test_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/actualbudget/actualbudget.py", line 145, in test_connection
    return await self.hass.async_add_executor_job(self.test_connection_sync)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/actualbudget/actualbudget.py", line 149, in test_connection_sync
    with Actual(
  File "/usr/local/lib/python3.12/site-packages/actual/__init__.py", line 92, in __enter__
    self.download_budget(self._encryption_password)
  File "/usr/local/lib/python3.12/site-packages/actual/__init__.py", line 328, in download_budget
    self.run_migrations(migration_files[1:])
  File "/usr/local/lib/python3.12/site-packages/actual/__init__.py", line 144, in run_migrations
    conn.executescript(sql_statements)
sqlite3.IntegrityError: UNIQUE constraint failed: dashboard.id

Any help would be appreciated!

jlvcm commented 2 days ago

I think this is an issue with the latest version of ActualBudget, I didn't had time to fix this sorry :(, will work on this as soon as possible, need to pull the changes from the Actualpy repo

bambamalicious commented 2 days ago

Not a problem, and thanks for the quick reply!

Looking forward to getting it up and running so I can display the figures we need on our Magic Mirror ;)