Clawith icon indicating copy to clipboard operation
Clawith copied to clipboard

[Bug]Regression after merging PR #178: backend fails to start due to stale password_reset_token import

Open Atlas-SZ opened this issue 8 months ago • 1 comments

Pre-checks

Deployment Method

Docker

Steps to Reproduce

  1. Pull the latest main branch after PR #178 has been merged.

  2. Run:

    docker compose up -d --build
    
    
  3. Check the backend container logs:

    docker compose logs -f backend

  4. Observe that the backend fails during startup and enters a restart loop.

  5. The log shows:

    [entrypoint] Step 1: Creating/verifying database tables... ModuleNotFoundError: No module named 'app.models.password_reset_token'

Expected vs Actual Behavior

Expected behavior The backend should start normally after PR #178 was merged. Since password reset token storage was later migrated to Redis, startup should no longer import the removed app.models.password_reset_token module.

Actual behavior The backend fails during startup because stale imports of app.models.password_reset_token are still present in the startup path, even though the model was removed later. This causes ModuleNotFoundError and puts the backend container into a restart loop.

The stale imports are currently present in:

  • backend/entrypoint.sh:50
  • backend/app/main.py:101

From the merged PR timeline, the later follow-up refactor migrated password reset tokens from SQL storage to Redis and removed the PasswordResetToken model, but the startup imports were not cleaned up completely.

If you want, I can also format a short Additional Context section for the same issue form.

Logs / Screenshots

atlas@iZ2zeczbe6wnqqbaio0jyhZ:/opt/code/mnt/Clawith$ sudo docker logs 9f7da55897f5 [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' atlas@iZ2zeczbe6wnqqbaio0jyhZ:/opt/code/mnt/Clawith$ sudo docker logs 9f7da55897f5 [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call last): File "", line 78, in File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "", line 26, in main ModuleNotFoundError: No module named 'app.models.password_reset_token' [entrypoint] Detected root user, fixing permissions... [entrypoint] Dropping privileges to 'clawith' and re-executing... [entrypoint] Step 1: Creating/verifying database tables... Traceback (most recent call l

Atlas-SZ avatar Mar 30 '26 02:03 Atlas-SZ

i also find this bug

wangxianjin028 avatar Mar 30 '26 02:03 wangxianjin028