Skip to content

Bug: Backvault gets stuck in a restart loop after server shutdown #70

Description

@titandrive

After a host reboot, Backvault immediately enters a restart loop. The logs consistently show bw login --apikey failing. Simply redeploying the exact same Compose stack (no configuration changes) causes it to start successfully. This occurs every reboot.

Full Logs:

src.utils.BitwardenError: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.
Changing appuser group to PGID 1000
addgroup: group 'appgroup' in use
Initializing Backvault container...
Running initial backup...
2026-07-21 15:45:17,775 INFO: Connecting to database at /app/db/backvault.db
2026-07-21 15:45:18,011 INFO: Connecting to vault...
2026-07-21 15:45:21,087 INFO: Logging in via API key
2026-07-21 15:45:22,311 ERROR: Failed to run command: Command '['bw', 'login', '--apikey']' returned non-zero exit status 1.
2026-07-21 15:45:23,393 ERROR: Failed to log out after error. Failure: Command '['bw', 'logout']' returned non-zero exit status 1.
2026-07-21 15:45:23,393 ERROR: Login failed: Failed to run command: Command '['bw', 'login', '--apikey']' returned non-zero exit status 1.
2026-07-21 15:45:24,585 ERROR: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.
2026-07-21 15:45:25,815 ERROR: Failed to log out after error. Failure: Command '['bw', 'logout']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/app/src/run.py", line 114, in <module>
    main()
    ~~~~^^
  File "/app/src/run.py", line 109, in main
    source.logout()
    ~~~~~~~~~~~~~^^
  File "/app/src/bw_client.py", line 195, in logout
    self._run(["logout"], capture_json=False)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/bw_client.py", line 158, in _run
    raise BitwardenError(f"Failed to run command: {masked_e}") from None
src.utils.BitwardenError: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.
Changing appuser group to PGID 1000
addgroup: group 'appgroup' in use
Initializing Backvault container...
Running initial backup...
2026-07-21 15:45:38,851 INFO: Connecting to database at /app/db/backvault.db
2026-07-21 15:45:39,056 INFO: Connecting to vault...
2026-07-21 15:45:42,466 INFO: Logging in via API key
2026-07-21 15:45:43,742 ERROR: Failed to run command: Command '['bw', 'login', '--apikey']' returned non-zero exit status 1.
2026-07-21 15:45:45,055 ERROR: Failed to log out after error. Failure: Command '['bw', 'logout']' returned non-zero exit status 1.
2026-07-21 15:45:45,055 ERROR: Login failed: Failed to run command: Command '['bw', 'login', '--apikey']' returned non-zero exit status 1.
2026-07-21 15:45:46,239 ERROR: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.
2026-07-21 15:45:47,379 ERROR: Failed to log out after error. Failure: Command '['bw', 'logout']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/app/src/run.py", line 114, in <module>
    main()
    ~~~~^^
  File "/app/src/run.py", line 109, in main
    source.logout()
    ~~~~~~~~~~~~~^^
  File "/app/src/bw_client.py", line 195, in logout
    self._run(["logout"], capture_json=False)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/bw_client.py", line 158, in _run
    raise BitwardenError(f"Failed to run command: {masked_e}") from None
src.utils.BitwardenError: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.
Changing appuser group to PGID 1000
addgroup: group 'appgroup' in use
Initializing Backvault container...
Running initial backup...
2026-07-21 15:46:13,252 INFO: Connecting to database at /app/db/backvault.db
2026-07-21 15:46:13,452 INFO: Connecting to vault...
2026-07-21 15:46:16,723 INFO: Logging in via API key
2026-07-21 15:46:17,915 ERROR: Failed to run command: Command '['bw', 'login', '--apikey']' returned non-zero exit status 1.
2026-07-21 15:46:19,198 ERROR: Failed to log out after error. Failure: Command '['bw', 'logout']' returned non-zero exit status 1.
2026-07-21 15:46:19,198 ERROR: Login failed: Failed to run command: Command '['bw', 'login', '--apikey']' returned non-zero exit status 1.
2026-07-21 15:46:20,330 ERROR: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.
2026-07-21 15:46:21,445 ERROR: Failed to log out after error. Failure: Command '['bw', 'logout']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/app/src/run.py", line 114, in <module>
    main()
    ~~~~^^
  File "/app/src/run.py", line 109, in main
    source.logout()
    ~~~~~~~~~~~~~^^
  File "/app/src/bw_client.py", line 195, in logout
    self._run(["logout"], capture_json=False)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/bw_client.py", line 158, in _run
    raise BitwardenError(f"Failed to run command: {masked_e}") from None
src.utils.BitwardenError: Failed to run command: Command '['bw', 'logout']' returned non-zero exit status 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions