Vaultwarden fails to start after update – DB migration error (SSO)
-
Hello @factord
This looks like a copy-paste issue from Windows.
\rin line 2 is a blank line, so a line break.
When you copy and pasted, it pasted the line breaks windows style.Please describe how you have copy and pasted the code into the
/app/data/fix_db.shfile. -
I have the same issue as @factord I am on windows 11 and created the file through the file manager, pasted the contents copied from the post into the file using the built in file editor that is a part of the file manager, saved the file, opened the web terminal and ran the
bash /app/data/fix_db.shcommand. -
I have run the command
sed -i 's/\r$//g' /app/data/fix_db.shto fix the new line characters and then runbash /app/data/fix_db.shagain and it ran as expected. Disabled recover mode and confirmed things are back to working as expected. -
So everytime I upgrade from Vaultwarden 1.34.3 to 1.35.0 the instance becomes unresponsive, saying connection failure in the terminal and nothing really in the logs apart from connection failure again.
Jan 06 12:13:28 0: vaultwarden::init_logging::{{closure}} Jan 06 12:13:28 10: std::sys::backtrace::__rust_begin_short_backtrace Jan 06 12:13:28 11: main Jan 06 12:13:28 12: <unknown> Jan 06 12:13:28 13: __libc_start_main Jan 06 12:13:28 14: _start Jan 06 12:13:28 1: std::panicking::panic_with_hook Jan 06 12:13:28 2: std::panicking::panic_handler::{{closure}} Jan 06 12:13:28 3: std::sys::backtrace::__rust_end_short_backtrace Jan 06 12:13:28 4: __rustc::rust_begin_unwind Jan 06 12:13:28 5: core::panicking::panic_fmt Jan 06 12:13:28 6: core::result::unwrap_failed Jan 06 12:13:28 7: vaultwarden::db::DbPool::from_config Jan 06 12:13:28 8: vaultwarden::main::{{closure}} Jan 06 12:13:28 9: vaultwarden::main Jan 06 12:13:28 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`. Jan 06 12:13:28 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token Jan 06 12:13:28 [2026-01-06 12:13:28.418][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505 Jan 06 12:13:28 [INFO] Using saved config from `/app/data/config.json` for configuration. Jan 06 12:13:28 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure. Jan 06 12:13:28 \--------------------------------------------------------------------/ Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/discussions or | Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/issues/new | Jan 06 12:13:28 | https://vaultwarden.discourse.group/ | Jan 06 12:13:28 | Report suspected bugs/issues in the software itself at: | Jan 06 12:13:28 | Send usage/configuration questions or feature requests to: | Jan 06 12:13:28 | official channels to report bugs/features, regardless of client. | Jan 06 12:13:37 => Healthcheck error: AbortError: The operation was aborted Jan 06 12:13:41 => Healthcheck error: Error: connect ECONNREFUSED 172.18.16.123:3000 Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 /--------------------------------------------------------------------\ Jan 06 12:13:41 0: vaultwarden::init_logging::{{closure}} Jan 06 12:13:41 10: std::sys::backtrace::__rust_begin_short_backtrace Jan 06 12:13:41 11: main Jan 06 12:13:41 12: <unknown> Jan 06 12:13:41 13: __libc_start_main Jan 06 12:13:41 14: _start Jan 06 12:13:41 1: std::panicking::panic_with_hook Jan 06 12:13:41 2: std::panicking::panic_handler::{{closure}} Jan 06 12:13:41 3: std::sys::backtrace::__rust_end_short_backtrace Jan 06 12:13:41 4: __rustc::rust_begin_unwind Jan 06 12:13:41 5: core::panicking::panic_fmt Jan 06 12:13:41 6: core::result::unwrap_failed Jan 06 12:13:41 7: vaultwarden::db::DbPool::from_config Jan 06 12:13:41 8: vaultwarden::main::{{closure}} Jan 06 12:13:41 9: vaultwarden::main Jan 06 12:13:41 => Exporting env vars expected by Vaultwarden Jan 06 12:13:41 => Starting Bitwarden Jan 06 12:13:41 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`. Jan 06 12:13:41 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token Jan 06 12:13:41 [2026-01-06 12:13:41.691][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505 Jan 06 12:13:41 [INFO] Using saved config from `/app/data/config.json` for configuration. Jan 06 12:13:41 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure. Jan 06 12:13:41 \--------------------------------------------------------------------/ Jan 06 12:13:41 | Starting Vaultwarden | Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/discussions or | Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/issues/new | Jan 06 12:13:41 | https://vaultwarden.discourse.group/ | Jan 06 12:13:41 | Report suspected bugs/issues in the software itself at: | Jan 06 12:13:41 | Send usage/configuration questions or feature requests to: | Jan 06 12:13:41 | This is an *unofficial* Bitwarden implementation, DO NOT use the | Jan 06 12:13:41 | official channels to report bugs/features, regardless of client. | Jan 06 12:13:41 |--------------------------------------------------------------------| Jan 06 12:13:52 => Healthcheck error: Error: connect EHOSTUNREACH 172.18.16.123:3000I then have to restore the 1.34.3 version for vaultwarden to work again. I have also had to disable auto update. Please note that I know there are two updates from 1.34.3, but both updates have the same connection issue.
-
So everytime I upgrade from Vaultwarden 1.34.3 to 1.35.0 the instance becomes unresponsive, saying connection failure in the terminal and nothing really in the logs apart from connection failure again.
Jan 06 12:13:28 0: vaultwarden::init_logging::{{closure}} Jan 06 12:13:28 10: std::sys::backtrace::__rust_begin_short_backtrace Jan 06 12:13:28 11: main Jan 06 12:13:28 12: <unknown> Jan 06 12:13:28 13: __libc_start_main Jan 06 12:13:28 14: _start Jan 06 12:13:28 1: std::panicking::panic_with_hook Jan 06 12:13:28 2: std::panicking::panic_handler::{{closure}} Jan 06 12:13:28 3: std::sys::backtrace::__rust_end_short_backtrace Jan 06 12:13:28 4: __rustc::rust_begin_unwind Jan 06 12:13:28 5: core::panicking::panic_fmt Jan 06 12:13:28 6: core::result::unwrap_failed Jan 06 12:13:28 7: vaultwarden::db::DbPool::from_config Jan 06 12:13:28 8: vaultwarden::main::{{closure}} Jan 06 12:13:28 9: vaultwarden::main Jan 06 12:13:28 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`. Jan 06 12:13:28 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token Jan 06 12:13:28 [2026-01-06 12:13:28.418][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505 Jan 06 12:13:28 [INFO] Using saved config from `/app/data/config.json` for configuration. Jan 06 12:13:28 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure. Jan 06 12:13:28 \--------------------------------------------------------------------/ Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/discussions or | Jan 06 12:13:28 | https://github.com/dani-garcia/vaultwarden/issues/new | Jan 06 12:13:28 | https://vaultwarden.discourse.group/ | Jan 06 12:13:28 | Report suspected bugs/issues in the software itself at: | Jan 06 12:13:28 | Send usage/configuration questions or feature requests to: | Jan 06 12:13:28 | official channels to report bugs/features, regardless of client. | Jan 06 12:13:37 => Healthcheck error: AbortError: The operation was aborted Jan 06 12:13:41 => Healthcheck error: Error: connect ECONNREFUSED 172.18.16.123:3000 Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 2026-01-06T12:13:41Z Jan 06 12:13:41 /--------------------------------------------------------------------\ Jan 06 12:13:41 0: vaultwarden::init_logging::{{closure}} Jan 06 12:13:41 10: std::sys::backtrace::__rust_begin_short_backtrace Jan 06 12:13:41 11: main Jan 06 12:13:41 12: <unknown> Jan 06 12:13:41 13: __libc_start_main Jan 06 12:13:41 14: _start Jan 06 12:13:41 1: std::panicking::panic_with_hook Jan 06 12:13:41 2: std::panicking::panic_handler::{{closure}} Jan 06 12:13:41 3: std::sys::backtrace::__rust_end_short_backtrace Jan 06 12:13:41 4: __rustc::rust_begin_unwind Jan 06 12:13:41 5: core::panicking::panic_fmt Jan 06 12:13:41 6: core::result::unwrap_failed Jan 06 12:13:41 7: vaultwarden::db::DbPool::from_config Jan 06 12:13:41 8: vaultwarden::main::{{closure}} Jan 06 12:13:41 9: vaultwarden::main Jan 06 12:13:41 => Exporting env vars expected by Vaultwarden Jan 06 12:13:41 => Starting Bitwarden Jan 06 12:13:41 Please generate a secure Argon2 PHC string by using `vaultwarden hash` or `argon2`. Jan 06 12:13:41 See: https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page#secure-the-admin_token Jan 06 12:13:41 [2026-01-06 12:13:41.691][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-03-06-170000_add_sso_users", version: MigrationVersion("20240306170000") }, DatabaseError(Unknown, "Referencing column 'user_uuid' and referenced column 'uuid' in foreign key constraint 'sso_users_ibfk_1' are incompatible."))': src/db/mod.rs:505 Jan 06 12:13:41 [INFO] Using saved config from `/app/data/config.json` for configuration. Jan 06 12:13:41 [NOTICE] You are using a plain text `ADMIN_TOKEN` which is insecure. Jan 06 12:13:41 \--------------------------------------------------------------------/ Jan 06 12:13:41 | Starting Vaultwarden | Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/discussions or | Jan 06 12:13:41 | https://github.com/dani-garcia/vaultwarden/issues/new | Jan 06 12:13:41 | https://vaultwarden.discourse.group/ | Jan 06 12:13:41 | Report suspected bugs/issues in the software itself at: | Jan 06 12:13:41 | Send usage/configuration questions or feature requests to: | Jan 06 12:13:41 | This is an *unofficial* Bitwarden implementation, DO NOT use the | Jan 06 12:13:41 | official channels to report bugs/features, regardless of client. | Jan 06 12:13:41 |--------------------------------------------------------------------| Jan 06 12:13:52 => Healthcheck error: Error: connect EHOSTUNREACH 172.18.16.123:3000I then have to restore the 1.34.3 version for vaultwarden to work again. I have also had to disable auto update. Please note that I know there are two updates from 1.34.3, but both updates have the same connection issue.
Hello @apesorguk
I have merged your new topic into this one, since it is a duplication.
The fix has already been provided, see above https://forum.cloudron.io/post/117779 -
Hello @apesorguk
I have merged your new topic into this one, since it is a duplication.
The fix has already been provided, see above https://forum.cloudron.io/post/117779@james I get this problem.
root@bf8db951-7632-4ddf-bf9b-8b58cd65ffe5:/app/code# bash /app/data/fix_db.sh /app/data/fix_db.sh: line 2: $'\r': command not found => Checking if DEFAULT_CHARACTER_SET_NAME and DEFAULT_COLLATION_NAME are set to utf8mb4 and utf8mb4_unicode_ci /app/data/fix_db.sh: line 4: $'\r': command not found /app/data/fix_db.sh: line 8: $'\r': command not found /app/data/fix_db.sh: line 22: syntax error near unexpected token `$'in\r'' 'app/data/fix_db.sh: line 22: ` case $yn in root@bf8db951-7632-4ddf-bf9b-8b58cd65ffe5:/app/code# -
Hello @factord
This looks like a copy-paste issue from Windows.
\rin line 2 is a blank line, so a line break.
When you copy and pasted, it pasted the line breaks windows style.Please describe how you have copy and pasted the code into the
/app/data/fix_db.shfile.@apesorguk looks like you've hit the same copy-paste issue @james described here:
@james said in Vaultwarden fails to start after update – DB migration error (SSO):
This looks like a copy-paste issue from Windows.
\rin line 2 is a blank line, so a line break.
When you copy and pasted, it pasted the line breaks windows style.Please describe how you have copy and pasted the code into the
/app/data/fix_db.shfile. -
Thanks all fixed now. I found this worked even with the line brake.
I have run the command sed -i 's/\r$//g' /app/data/fix_db.sh to fix the new line characters and then run bash /app/data/fix_db.sh again and it ran as expected. Disabled recover mode and confirmed things are back to working as expected. -
-
@overholt Very likely you've hit the same thing as this thread. Solution here https://forum.cloudron.io/post/117779
-
I used this issue to improve my aidevops cloudron subagent, and it managed to fix the issue on all instances. More info here for anyone interested to add this to your toolkit:
-
I have run the command
sed -i 's/\r$//g' /app/data/fix_db.shto fix the new line characters and then runbash /app/data/fix_db.shagain and it ran as expected. Disabled recover mode and confirmed things are back to working as expected.@ChristopherMag Thanks, this fixed my issue.