DB migration failed after upgrade to 9.0.13
-
Description
After upgrade from 8 to 9.0.13 dashboard not working. With the hep of other post, I noticed my tasks table doesn't have completed column, so adding it manually solved the issue with dashboard not loading.
Steps to reproduce
After running troubleshoot script:
[FAIL] Database migrations are pending. Last migration in DB: /20250618200400-fix-charset-collate.js. Last migration file: /20251110084515-cloudflare-add-defaultProxyStatus.js.
Please run 'cloudron-support --apply-db-migrations' to apply the migrations.After running --apply-db-migrations:
Logs
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Duplicate entry '20647655-d757-412a-8a67-3b6ff3d224a3-oidc' for key 'oidcClients.PRIMARY'
at /home/yellowtent/box/node_modules/db-migrate/lib/commands/on-complete.js:15:14
at tryCatcher (/home/yellowtent/box/node_modules/bluebird/js/release/util.js:16:23)
at Promise.successAdapter (/home/yellowtent/box/node_modules/bluebird/js/release/nodeify.js:22:30)
at Promise._settlePromise (/home/yellowtent/box/node_modules/bluebird/js/release/promise.js:601:21)
at Promise._settlePromiseCtx (/home/yellowtent/box/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/home/yellowtent/box/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/home/yellowtent/box/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/yellowtent/box/node_modules/bluebird/js/release/async.js:102:5)
at Async.drainQueues [as _onImmediate] (/home/yellowtent/box/node_modules/bluebird/js/release/async.js:15:14)
at process.processImmediate (node:internal/timers:485:21)
at Packet.asError (/home/yellowtent/box/node_modules/mysql2/lib/packets/packet.js:740:17)
at Query.execute (/home/yellowtent/box/node_modules/mysql2/lib/commands/command.js:29:26)
at Connection.handlePacket (/home/yellowtent/box/node_modules/mysql2/lib/base/connection.js:477:34)
at PacketParser.onPacket (/home/yellowtent/box/node_modules/mysql2/lib/base/connection.js:93:12)
at PacketParser.executeStart (/home/yellowtent/box/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/home/yellowtent/box/node_modules/mysql2/lib/base/connection.js
25)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
2025-12-07T16:47:15 ==> start: DB migration failed
[FAIL] Database migrations failedCloudron Version
9.0.13
-
Changing the database schema manually is usually always a bad idea. It becomes very hard to apply the database migration scripts which have to be run one-after-the-other and with manual changes it is unknown at which schema state the database is and if subsequent migrations can work.
Do you know exactly which SQL query you ran manually to update the schema? If so ideally revert that and run db migration script again. It probably will just show the same error as before, so we can work from that on.
Duplicate entry '20647655-d757-412a-8a67-3b6ff3d224a3-oidc' for key 'oidcClients.PRIMARY'it seems like you have duplicate records in theoidcClientstable. Can you run:mysql -uroot -ppassword box -e "SELECT * from oidcClients"Then find the duplicates and remove one of them. Then rerun the migration script again.
-
Hi,
--apply-db-migrations had the same error before updating tasks table. I inserted column because of this repeating error in box.log:2025-12-07T15:23:51.233Z box:server ========================================== 2025-12-07T15:23:51.234Z box:server Cloudron 9.0.13 2025-12-07T15:23:51.234Z box:server ========================================== 2025-12-07T15:23:51.234Z box:platform initialize: start platform 2025-12-07T15:23:51.236Z box:tasks stopAllTasks: 0 tasks are running. sending abort signal 2025-12-07T15:23:51.236Z box:shell tasks: /usr/bin/sudo --non-interactive /home/yellowtent/box/src/scripts/stoptask.sh all 2025-12-07T15:23:51.293Z box:locks releaseAll: all locks released 2025-12-07T15:23:51.297Z box:reverseproxy writeDashboardConfig: writing dashboard config for cloud.voxellab.rs 2025-12-07T15:23:51.309Z box:shell reverseproxy: /usr/bin/sudo --non-interactive /home/yellowtent/box/src/scripts/restartservice.sh nginx 2025-12-07T15:23:51.646Z box:updater notifyBoxUpdate: update finished from 8.3.2 to 9.0.13 2025-12-07T15:23:51.648Z Error starting servers 2025-12-07T15:23:51.648Z BoxError: Unknown column 'completed' in 'field list' 2025-12-07T15:23:51.648Z at Object.query (/home/yellowtent/box/src/database.js:96:22) 2025-12-07T15:23:51.648Z at process.processTicksAndRejections (node:internal/process/task_queues:105:5) 2025-12-07T15:23:51.648Z at async list (/home/yellowtent/box/src/tasks.js:163:21) 2025-12-07T15:23:51.648Z at async Object.setCompletedByType (/home/yellowtent/box/src/tasks.js:172:21)I referred to forum post here where user had missing pending column after the same version upgrade.
Anyway, I used this:
USE box; SHOW COLUMNS FROM tasks; ALTER TABLE tasks ADD COLUMN completed TINYINT(1) NOT NULL DEFAULT 0; SHOW COLUMNS FROM tasks;This restored working dashboard and my server is operational at the moment, but I should resolve the oidc issue at some point.
Thanks